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