korganizer

koeditoralarms_base.cpp

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