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