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