kplato

kptcalendareditbase.cc

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Dag Andersen <danders@get2net.dk>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation;
00007    version 2 of the License.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include <klocale.h>
00021 
00022 #include "kptcalendareditbase.h"
00023 
00024 #include <qvariant.h>
00025 #include <qpushbutton.h>
00026 #include <qgroupbox.h>
00027 #include <kptcalendarpanel.h>
00028 #include <qlabel.h>
00029 #include <qcombobox.h>
00030 #include <qbuttongroup.h>
00031 #include <qheader.h>
00032 #include <qlistview.h>
00033 #include <qdatetimeedit.h>
00034 #include <qlayout.h>
00035 #include <qtooltip.h>
00036 #include <qwhatsthis.h>
00037 
00038 namespace KPlato
00039 {
00040 
00041 /*
00042  *  Constructs a CalendarEditBase as a child of 'parent', with the
00043  *  name 'name' and widget flags set to 'f'.
00044  */
00045 CalendarEditBase::CalendarEditBase( QWidget* parent, const char* name, WFlags fl )
00046     : QWidget( parent, name, fl )
00047 {
00048     if ( !name )
00049     setName( "CalendarEditBase" );
00050     CalendarEditBaseLayout = new QHBoxLayout( this, 0, 0, "CalendarEditBaseLayout");
00051 
00052     groupBox2 = new QGroupBox( this, "groupBox2" );
00053     groupBox2->setColumnLayout(0, Qt::Vertical );
00054     groupBox2->layout()->setSpacing( 6 );
00055     groupBox2->layout()->setMargin( 6 );
00056     groupBox2Layout = new QGridLayout( groupBox2->layout() );
00057     groupBox2Layout->setAlignment( Qt::AlignTop );
00058 
00059     calendarPanel = new CalendarPanel( groupBox2, "calendarPanel" );
00060 
00061     groupBox2Layout->addWidget( calendarPanel, 1, 0 );
00062 
00063     day = new QButtonGroup( groupBox2, "day" );
00064     day->setColumnLayout(0, Qt::Vertical );
00065     day->layout()->setSpacing( 6 );
00066     day->layout()->setMargin( 6 );
00067     dayLayout = new QVBoxLayout( day->layout() );
00068     dayLayout->setAlignment( Qt::AlignTop );
00069 
00070     layout8 = new QHBoxLayout( 0, 0, 6, "layout8");
00071 
00072     state = new QComboBox( FALSE, day, "state" );
00073     layout8->addWidget( state );
00074 
00075     bApply = new QPushButton( day, "bApply" );
00076     layout8->addWidget( bApply );
00077     dayLayout->addLayout( layout8 );
00078 
00079     groupBox4 = new QGroupBox( day, "groupBox4" );
00080     groupBox4->setColumnLayout(0, Qt::Vertical );
00081     groupBox4->layout()->setSpacing( 6 );
00082     groupBox4->layout()->setMargin( 6 );
00083     groupBox4Layout = new QVBoxLayout( groupBox4->layout() );
00084     groupBox4Layout->setAlignment( Qt::AlignTop );
00085 
00086     intervalList = new QListView( groupBox4, "intervalList" );
00087     intervalList->addColumn( tr2i18n( "Work Interval" ) );
00088     groupBox4Layout->addWidget( intervalList );
00089 
00090     layout6 = new QHBoxLayout( 0, 0, 6, "layout6");
00091 
00092     startTime = new QTimeEdit( groupBox4, "startTime" );
00093     layout6->addWidget( startTime );
00094 
00095     endTime = new QTimeEdit( groupBox4, "endTime" );
00096     layout6->addWidget( endTime );
00097     groupBox4Layout->addLayout( layout6 );
00098 
00099     layout5 = new QHBoxLayout( 0, 0, 6, "layout5");
00100 
00101     bClear = new QPushButton( groupBox4, "bClear" );
00102     layout5->addWidget( bClear );
00103 
00104     bAddInterval = new QPushButton( groupBox4, "bAddInterval" );
00105     layout5->addWidget( bAddInterval );
00106     groupBox4Layout->addLayout( layout5 );
00107     dayLayout->addWidget( groupBox4 );
00108 
00109     groupBox2Layout->addWidget( day, 1, 1 );
00110     CalendarEditBaseLayout->addWidget( groupBox2 );
00111     languageChange();
00112     resize( QSize(540, 340).expandedTo(minimumSizeHint()) );
00113     clearWState( WState_Polished );
00114 }
00115 
00116 /*
00117  *  Destroys the object and frees any allocated resources
00118  */
00119 CalendarEditBase::~CalendarEditBase()
00120 {
00121     // no need to delete child widgets, Qt does it all for us
00122 }
00123 
00124 /*
00125  *  Sets the strings of the subwidgets using the current
00126  *  language.
00127  */
00128 void CalendarEditBase::languageChange()
00129 {
00130     setCaption( tr2i18n( "CalendarEditBase" ) );
00131     groupBox2->setTitle( QString::null );
00132     day->setTitle( QString::null );
00133     bApply->setText( tr2i18n( "Apply" ) );
00134     groupBox4->setTitle( QString::null );
00135     intervalList->header()->setLabel( 0, tr2i18n( "Work Interval" ) );
00136     bClear->setText( tr2i18n( "Clear" ) );
00137     bAddInterval->setText( tr2i18n( "Add Interval" ) );
00138 }
00139 
00140 }  //KPlato namespace
00141 
00142 #include "kptcalendareditbase.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys