kplato

kptcalendareditbase.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2004 Dag Andersen <danders@get2net.dk>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation;
7 version 2 of the License.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include <tdelocale.h>
21
22#include "kptcalendareditbase.h"
23
24#include <tqvariant.h>
25#include <tqpushbutton.h>
26#include <tqgroupbox.h>
27#include <kptcalendarpanel.h>
28#include <tqlabel.h>
29#include <tqcombobox.h>
30#include <tqbuttongroup.h>
31#include <tqheader.h>
32#include <tqlistview.h>
33#include <tqdatetimeedit.h>
34#include <tqlayout.h>
35#include <tqtooltip.h>
36#include <tqwhatsthis.h>
37
38namespace KPlato
39{
40
41/*
42 * Constructs a CalendarEditBase as a child of 'parent', with the
43 * name 'name' and widget flags set to 'f'.
44 */
45CalendarEditBase::CalendarEditBase( TQWidget* parent, const char* name, WFlags fl )
46 : TQWidget( parent, name, fl )
47{
48 if ( !name )
49 setName( "CalendarEditBase" );
50 CalendarEditBaseLayout = new TQHBoxLayout( this, 0, 0, "CalendarEditBaseLayout");
51
52 groupBox2 = new TQGroupBox( this, "groupBox2" );
53 groupBox2->setColumnLayout(0, TQt::Vertical );
54 groupBox2->layout()->setSpacing( 6 );
55 groupBox2->layout()->setMargin( 6 );
56 groupBox2Layout = new TQGridLayout( groupBox2->layout() );
57 groupBox2Layout->setAlignment( TQt::AlignTop );
58
59 calendarPanel = new CalendarPanel( groupBox2, "calendarPanel" );
60
61 groupBox2Layout->addWidget( calendarPanel, 1, 0 );
62
63 day = new TQButtonGroup( groupBox2, "day" );
64 day->setColumnLayout(0, TQt::Vertical );
65 day->layout()->setSpacing( 6 );
66 day->layout()->setMargin( 6 );
67 dayLayout = new TQVBoxLayout( day->layout() );
68 dayLayout->setAlignment( TQt::AlignTop );
69
70 layout8 = new TQHBoxLayout( 0, 0, 6, "layout8");
71
72 state = new TQComboBox( false, day, "state" );
73 layout8->addWidget( state );
74
75 bApply = new TQPushButton( day, "bApply" );
76 layout8->addWidget( bApply );
77 dayLayout->addLayout( layout8 );
78
79 groupBox4 = new TQGroupBox( day, "groupBox4" );
80 groupBox4->setColumnLayout(0, TQt::Vertical );
81 groupBox4->layout()->setSpacing( 6 );
82 groupBox4->layout()->setMargin( 6 );
83 groupBox4Layout = new TQVBoxLayout( groupBox4->layout() );
84 groupBox4Layout->setAlignment( TQt::AlignTop );
85
86 intervalList = new TQListView( groupBox4, "intervalList" );
87 intervalList->addColumn( tr2i18n( "Work Interval" ) );
88 groupBox4Layout->addWidget( intervalList );
89
90 layout6 = new TQHBoxLayout( 0, 0, 6, "layout6");
91
92 startTime = new TQTimeEdit( groupBox4, "startTime" );
93 layout6->addWidget( startTime );
94
95 endTime = new TQTimeEdit( groupBox4, "endTime" );
96 layout6->addWidget( endTime );
97 groupBox4Layout->addLayout( layout6 );
98
99 layout5 = new TQHBoxLayout( 0, 0, 6, "layout5");
100
101 bClear = new TQPushButton( groupBox4, "bClear" );
102 layout5->addWidget( bClear );
103
104 bAddInterval = new TQPushButton( groupBox4, "bAddInterval" );
105 layout5->addWidget( bAddInterval );
106 groupBox4Layout->addLayout( layout5 );
107 dayLayout->addWidget( groupBox4 );
108
109 groupBox2Layout->addWidget( day, 1, 1 );
110 CalendarEditBaseLayout->addWidget( groupBox2 );
111 languageChange();
112 resize( TQSize(540, 340).expandedTo(minimumSizeHint()) );
113 clearWState( WState_Polished );
114}
115
116/*
117 * Destroys the object and frees any allocated resources
118 */
119CalendarEditBase::~CalendarEditBase()
120{
121 // no need to delete child widgets, TQt does it all for us
122}
123
124/*
125 * Sets the strings of the subwidgets using the current
126 * language.
127 */
128void CalendarEditBase::languageChange()
129{
130 setCaption( tr2i18n( "CalendarEditBase" ) );
131 groupBox2->setTitle( TQString() );
132 day->setTitle( TQString() );
133 bApply->setText( tr2i18n( "Apply" ) );
134 groupBox4->setTitle( TQString() );
135 intervalList->header()->setLabel( 0, tr2i18n( "Work Interval" ) );
136 bClear->setText( tr2i18n( "Clear" ) );
137 bAddInterval->setText( tr2i18n( "Add Interval" ) );
138}
139
140} //KPlato namespace
141
142#include "kptcalendareditbase.moc"