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