00001 #include <kdialog.h>
00002 #include <klocale.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "koeditoralarms_base.h"
00013
00014 #include <qvariant.h>
00015 #include <qpushbutton.h>
00016 #include <qgroupbox.h>
00017 #include <qspinbox.h>
00018 #include <qcombobox.h>
00019 #include <qlabel.h>
00020 #include <qcheckbox.h>
00021 #include <qbuttongroup.h>
00022 #include <qradiobutton.h>
00023 #include <qframe.h>
00024 #include <qwidgetstack.h>
00025 #include <qtextedit.h>
00026 #include <kurlrequester.h>
00027 #include <qlineedit.h>
00028 #include <qheader.h>
00029 #include <qlistview.h>
00030 #include <qlayout.h>
00031 #include <qtooltip.h>
00032 #include <qwhatsthis.h>
00033
00034
00035
00036
00037
00038 KOEditorAlarms_base::KOEditorAlarms_base( QWidget* parent, const char* name, WFlags fl )
00039 : QWidget( parent, name, fl )
00040 {
00041 if ( !name )
00042 setName( "KOEditorAlarms_base" );
00043 KOEditorAlarms_baseLayout = new QGridLayout( this, 1, 1, 0, 6, "KOEditorAlarms_baseLayout");
00044
00045 mTimeGroup = new QGroupBox( this, "mTimeGroup" );
00046 mTimeGroup->setColumnLayout(0, Qt::Vertical );
00047 mTimeGroup->layout()->setSpacing( 6 );
00048 mTimeGroup->layout()->setMargin( 11 );
00049 mTimeGroupLayout = new QVBoxLayout( mTimeGroup->layout() );
00050 mTimeGroupLayout->setAlignment( Qt::AlignTop );
00051
00052 layout3 = new QHBoxLayout( 0, 0, 6, "layout3");
00053
00054 mAlarmOffset = new QSpinBox( mTimeGroup, "mAlarmOffset" );
00055 mAlarmOffset->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)0, 0, 0, mAlarmOffset->sizePolicy().hasHeightForWidth() ) );
00056 layout3->addWidget( mAlarmOffset );
00057
00058 mOffsetUnit = new QComboBox( FALSE, mTimeGroup, "mOffsetUnit" );
00059 layout3->addWidget( mOffsetUnit );
00060
00061 mBeforeAfter = new QComboBox( FALSE, mTimeGroup, "mBeforeAfter" );
00062 layout3->addWidget( mBeforeAfter );
00063 mTimeGroupLayout->addLayout( layout3 );
00064
00065 layout8 = new QGridLayout( 0, 1, 1, 0, 6, "layout8");
00066
00067 mHowOftenLabel = new QLabel( mTimeGroup, "mHowOftenLabel" );
00068 mHowOftenLabel->setEnabled( FALSE );
00069 mHowOftenLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)5, 0, 0, mHowOftenLabel->sizePolicy().hasHeightForWidth() ) );
00070
00071 layout8->addWidget( mHowOftenLabel, 0, 1 );
00072
00073 mRepeatCount = new QSpinBox( mTimeGroup, "mRepeatCount" );
00074 mRepeatCount->setEnabled( FALSE );
00075 mRepeatCount->setMaxValue( 500 );
00076 mRepeatCount->setMinValue( 1 );
00077
00078 layout8->addWidget( mRepeatCount, 0, 2 );
00079
00080 mIntervalLabel = new QLabel( mTimeGroup, "mIntervalLabel" );
00081 mIntervalLabel->setEnabled( FALSE );
00082
00083 layout8->addWidget( mIntervalLabel, 1, 1 );
00084
00085 mRepeats = new QCheckBox( mTimeGroup, "mRepeats" );
00086 mRepeats->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)0, 0, 0, mRepeats->sizePolicy().hasHeightForWidth() ) );
00087
00088 layout8->addWidget( mRepeats, 0, 0 );
00089
00090 mRepeatInterval = new QSpinBox( mTimeGroup, "mRepeatInterval" );
00091 mRepeatInterval->setEnabled( FALSE );
00092 mRepeatInterval->setMaxValue( 999 );
00093 mRepeatInterval->setMinValue( 1 );
00094
00095 layout8->addWidget( mRepeatInterval, 1, 2 );
00096 mTimeGroupLayout->addLayout( layout8 );
00097
00098 KOEditorAlarms_baseLayout->addWidget( mTimeGroup, 1, 0 );
00099
00100 mTypeGroup = new QGroupBox( this, "mTypeGroup" );
00101 mTypeGroup->setColumnLayout(0, Qt::Vertical );
00102 mTypeGroup->layout()->setSpacing( 6 );
00103 mTypeGroup->layout()->setMargin( 11 );
00104 mTypeGroupLayout = new QHBoxLayout( mTypeGroup->layout() );
00105 mTypeGroupLayout->setAlignment( Qt::AlignTop );
00106
00107 mAlarmType = new QButtonGroup( mTypeGroup, "mAlarmType" );
00108 mAlarmType->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)5, 0, 0, mAlarmType->sizePolicy().hasHeightForWidth() ) );
00109 mAlarmType->setFrameShape( QButtonGroup::NoFrame );
00110 mAlarmType->setLineWidth( 0 );
00111 mAlarmType->setFlat( TRUE );
00112 mAlarmType->setColumnLayout(0, Qt::Vertical );
00113 mAlarmType->layout()->setSpacing( 6 );
00114 mAlarmType->layout()->setMargin( 0 );
00115 mAlarmTypeLayout = new QVBoxLayout( mAlarmType->layout() );
00116 mAlarmTypeLayout->setAlignment( Qt::AlignTop );
00117
00118 mTypeDisplayRadio = new QRadioButton( mAlarmType, "mTypeDisplayRadio" );
00119 mTypeDisplayRadio->setChecked( TRUE );
00120 mAlarmTypeLayout->addWidget( mTypeDisplayRadio );
00121
00122 mTypeSoundRadio = new QRadioButton( mAlarmType, "mTypeSoundRadio" );
00123 mAlarmTypeLayout->addWidget( mTypeSoundRadio );
00124
00125 mTypeAppRadio = new QRadioButton( mAlarmType, "mTypeAppRadio" );
00126 mAlarmTypeLayout->addWidget( mTypeAppRadio );
00127
00128 mTypeEmailRadio = new QRadioButton( mAlarmType, "mTypeEmailRadio" );
00129 mTypeEmailRadio->setEnabled( FALSE );
00130 mAlarmTypeLayout->addWidget( mTypeEmailRadio );
00131 spacer2 = new QSpacerItem( 21, 41, QSizePolicy::Minimum, QSizePolicy::Expanding );
00132 mAlarmTypeLayout->addItem( spacer2 );
00133 mTypeGroupLayout->addWidget( mAlarmType );
00134
00135 line1 = new QFrame( mTypeGroup, "line1" );
00136 line1->setFrameShape( QFrame::VLine );
00137 line1->setFrameShadow( QFrame::Sunken );
00138 line1->setFrameShape( QFrame::VLine );
00139 mTypeGroupLayout->addWidget( line1 );
00140
00141 mTypeStack = new QWidgetStack( mTypeGroup, "mTypeStack" );
00142
00143 WStackPage = new QWidget( mTypeStack, "WStackPage" );
00144 WStackPageLayout = new QVBoxLayout( WStackPage, 0, 6, "WStackPageLayout");
00145
00146 mDisplayTextLabel = new QLabel( WStackPage, "mDisplayTextLabel" );
00147 WStackPageLayout->addWidget( mDisplayTextLabel );
00148
00149 mDisplayText = new QTextEdit( WStackPage, "mDisplayText" );
00150 WStackPageLayout->addWidget( mDisplayText );
00151 mTypeStack->addWidget( WStackPage, 0 );
00152
00153 WStackPage_2 = new QWidget( mTypeStack, "WStackPage_2" );
00154 WStackPageLayout_2 = new QVBoxLayout( WStackPage_2, 0, 6, "WStackPageLayout_2");
00155
00156 mSoundFileLabel = new QLabel( WStackPage_2, "mSoundFileLabel" );
00157 WStackPageLayout_2->addWidget( mSoundFileLabel );
00158
00159 mSoundFile = new KURLRequester( WStackPage_2, "mSoundFile" );
00160 WStackPageLayout_2->addWidget( mSoundFile );
00161 spacer3 = new QSpacerItem( 20, 61, QSizePolicy::Minimum, QSizePolicy::Expanding );
00162 WStackPageLayout_2->addItem( spacer3 );
00163 mTypeStack->addWidget( WStackPage_2, 1 );
00164
00165 WStackPage_3 = new QWidget( mTypeStack, "WStackPage_3" );
00166 WStackPageLayout_3 = new QVBoxLayout( WStackPage_3, 0, 6, "WStackPageLayout_3");
00167
00168 mApplicationLabel = new QLabel( WStackPage_3, "mApplicationLabel" );
00169 WStackPageLayout_3->addWidget( mApplicationLabel );
00170
00171 mApplication = new KURLRequester( WStackPage_3, "mApplication" );
00172 WStackPageLayout_3->addWidget( mApplication );
00173
00174 mAppArgumentsLabel = new QLabel( WStackPage_3, "mAppArgumentsLabel" );
00175 WStackPageLayout_3->addWidget( mAppArgumentsLabel );
00176
00177 mAppArguments = new QLineEdit( WStackPage_3, "mAppArguments" );
00178 WStackPageLayout_3->addWidget( mAppArguments );
00179 spacer3_2 = new QSpacerItem( 20, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
00180 WStackPageLayout_3->addItem( spacer3_2 );
00181 mTypeStack->addWidget( WStackPage_3, 2 );
00182
00183 WStackPage_4 = new QWidget( mTypeStack, "WStackPage_4" );
00184 WStackPageLayout_4 = new QGridLayout( WStackPage_4, 1, 1, 0, 6, "WStackPageLayout_4");
00185
00186 mEmailTextLabel = new QLabel( WStackPage_4, "mEmailTextLabel" );
00187
00188 WStackPageLayout_4->addMultiCellWidget( mEmailTextLabel, 1, 1, 0, 1 );
00189
00190 mEmailText = new QTextEdit( WStackPage_4, "mEmailText" );
00191
00192 WStackPageLayout_4->addMultiCellWidget( mEmailText, 2, 2, 0, 1 );
00193
00194 mEmailAddress = new KPIM::AddresseeLineEdit( WStackPage_4, "mEmailAddress" );
00195
00196 WStackPageLayout_4->addWidget( mEmailAddress, 0, 1 );
00197
00198 mEmailToLabel = new QLabel( WStackPage_4, "mEmailToLabel" );
00199
00200 WStackPageLayout_4->addWidget( mEmailToLabel, 0, 0 );
00201 mTypeStack->addWidget( WStackPage_4, 3 );
00202 mTypeGroupLayout->addWidget( mTypeStack );
00203
00204 KOEditorAlarms_baseLayout->addWidget( mTypeGroup, 2, 0 );
00205
00206 layout7 = new QGridLayout( 0, 1, 1, 0, 6, "layout7");
00207
00208 mRemoveButton = new QPushButton( this, "mRemoveButton" );
00209
00210 layout7->addWidget( mRemoveButton, 2, 1 );
00211
00212 mAddButton = new QPushButton( this, "mAddButton" );
00213
00214 layout7->addWidget( mAddButton, 0, 1 );
00215
00216 mDuplicateButton = new QPushButton( this, "mDuplicateButton" );
00217
00218 layout7->addWidget( mDuplicateButton, 1, 1 );
00219 spacer1 = new QSpacerItem( 20, 60, QSizePolicy::Minimum, QSizePolicy::Expanding );
00220 layout7->addItem( spacer1, 3, 1 );
00221
00222 mAlarmList = new QListView( this, "mAlarmList" );
00223 mAlarmList->addColumn( tr2i18n( "Type" ) );
00224 mAlarmList->header()->setClickEnabled( FALSE, mAlarmList->header()->count() - 1 );
00225 mAlarmList->addColumn( tr2i18n( "Time Offset" ) );
00226 mAlarmList->header()->setClickEnabled( FALSE, mAlarmList->header()->count() - 1 );
00227 mAlarmList->addColumn( tr2i18n( "Repeat" ) );
00228 mAlarmList->header()->setClickEnabled( FALSE, mAlarmList->header()->count() - 1 );
00229 mAlarmList->setAllColumnsShowFocus( TRUE );
00230 mAlarmList->setResizeMode( QListView::AllColumns );
00231
00232 layout7->addMultiCellWidget( mAlarmList, 0, 3, 0, 0 );
00233
00234 KOEditorAlarms_baseLayout->addLayout( layout7, 0, 0 );
00235 languageChange();
00236 resize( QSize(500, 300).expandedTo(minimumSizeHint()) );
00237 clearWState( WState_Polished );
00238
00239
00240 connect( mAlarmType, SIGNAL( clicked(int) ), mTypeStack, SLOT( raiseWidget(int) ) );
00241 connect( mRepeats, SIGNAL( toggled(bool) ), mIntervalLabel, SLOT( setEnabled(bool) ) );
00242 connect( mRepeats, SIGNAL( toggled(bool) ), mRepeatInterval, SLOT( setEnabled(bool) ) );
00243 connect( mRepeats, SIGNAL( toggled(bool) ), mHowOftenLabel, SLOT( setEnabled(bool) ) );
00244 connect( mRepeats, SIGNAL( toggled(bool) ), mRepeatCount, SLOT( setEnabled(bool) ) );
00245
00246
00247 mHowOftenLabel->setBuddy( mRepeatCount );
00248 mIntervalLabel->setBuddy( mRepeatInterval );
00249 mDisplayTextLabel->setBuddy( mDisplayText );
00250 mSoundFileLabel->setBuddy( mSoundFile );
00251 mApplicationLabel->setBuddy( mApplication );
00252 mAppArgumentsLabel->setBuddy( mAppArguments );
00253 mEmailTextLabel->setBuddy( mEmailText );
00254 }
00255
00256
00257
00258
00259 KOEditorAlarms_base::~KOEditorAlarms_base()
00260 {
00261
00262 }
00263
00264
00265
00266
00267
00268 void KOEditorAlarms_base::languageChange()
00269 {
00270 setCaption( tr2i18n( "Alarms" ) );
00271 mTimeGroup->setTitle( tr2i18n( "Time Offset" ) );
00272 mOffsetUnit->clear();
00273 mOffsetUnit->insertItem( tr2i18n( "minute(s)" ) );
00274 mOffsetUnit->insertItem( tr2i18n( "hour(s)" ) );
00275 mOffsetUnit->insertItem( tr2i18n( "day(s)" ) );
00276 mBeforeAfter->clear();
00277 mBeforeAfter->insertItem( tr2i18n( "before the start" ) );
00278 mBeforeAfter->insertItem( tr2i18n( "after the start" ) );
00279 mBeforeAfter->insertItem( tr2i18n( "before the end" ) );
00280 mBeforeAfter->insertItem( tr2i18n( "after the end" ) );
00281 mHowOftenLabel->setText( tr2i18n( "&How often:" ) );
00282 mRepeatCount->setSuffix( tr2i18n( " time(s)" ) );
00283 mIntervalLabel->setText( tr2i18n( "&Interval:" ) );
00284 mRepeats->setText( tr2i18n( "&Repeat:" ) );
00285 mRepeatInterval->setPrefix( tr2i18n( "every " ) );
00286 mRepeatInterval->setSuffix( tr2i18n( " minute(s)" ) );
00287 mTypeGroup->setTitle( tr2i18n( "Type" ) );
00288 mAlarmType->setTitle( QString::null );
00289 mTypeDisplayRadio->setText( tr2i18n( "&Reminder Dialog" ) );
00290 mTypeSoundRadio->setText( tr2i18n( "A&udio" ) );
00291 mTypeAppRadio->setText( tr2i18n( "Program" ) );
00292 mTypeEmailRadio->setText( tr2i18n( "Email" ) );
00293 mDisplayTextLabel->setText( tr2i18n( "Reminder Dialog &text:" ) );
00294 mSoundFileLabel->setText( tr2i18n( "Audio &file:" ) );
00295 mSoundFile->setFilter( tr2i18n( "audio/x-wav audio/x-mp3 application/ogg" ) );
00296 mApplicationLabel->setText( tr2i18n( "&Program file:" ) );
00297 mApplication->setFilter( tr2i18n( "*.*|All files" ) );
00298 mAppArgumentsLabel->setText( tr2i18n( "Program ar&guments:" ) );
00299 mEmailTextLabel->setText( tr2i18n( "Email &message text:" ) );
00300 mEmailToLabel->setText( tr2i18n( "Email &address(es):" ) );
00301 mRemoveButton->setText( tr2i18n( "&Remove..." ) );
00302 mAddButton->setText( tr2i18n( "&Add" ) );
00303 mDuplicateButton->setText( tr2i18n( "D&uplicate" ) );
00304 mAlarmList->header()->setLabel( 0, tr2i18n( "Type" ) );
00305 mAlarmList->header()->setLabel( 1, tr2i18n( "Time Offset" ) );
00306 mAlarmList->header()->setLabel( 2, tr2i18n( "Repeat" ) );
00307 }
00308
00309 #include "koeditoralarms_base.moc"