summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-06-29 06:30:43 (UTC)
committer ulf69 <ulf69>2004-06-29 06:30:43 (UTC)
commit2d5b376ae1329d82d1ce1947b972b30866abff9b (patch) (unidiff)
tree972d674c2c3939ed60c5a4a0c0ae33328ee47674
parent5bfd50da45591c581a7703d442b250e6e5294d9f (diff)
downloadkdepimpi-2d5b376ae1329d82d1ce1947b972b30866abff9b.zip
kdepimpi-2d5b376ae1329d82d1ce1947b972b30866abff9b.tar.gz
kdepimpi-2d5b376ae1329d82d1ce1947b972b30866abff9b.tar.bz2
removed references to moc files
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/categoryeditdialog.cpp2
-rw-r--r--libkdepim/categoryeditdialog_base.cpp2
-rw-r--r--libkdepim/categoryselectdialog.cpp2
-rw-r--r--libkdepim/categoryselectdialog_base.cpp2
-rw-r--r--libkdepim/kdateedit.cpp2
-rw-r--r--libkdepim/kdatepicker.cpp2
-rw-r--r--libkdepim/kprefsdialog.cpp2
-rw-r--r--libkdepim/libkdepimE.pro3
8 files changed, 9 insertions, 8 deletions
diff --git a/libkdepim/categoryeditdialog.cpp b/libkdepim/categoryeditdialog.cpp
index 87172c1..f719c31 100644
--- a/libkdepim/categoryeditdialog.cpp
+++ b/libkdepim/categoryeditdialog.cpp
@@ -1,135 +1,135 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qstringlist.h> 24#include <qstringlist.h>
25#include <qlineedit.h> 25#include <qlineedit.h>
26#include <qlistview.h> 26#include <qlistview.h>
27#include <qheader.h> 27#include <qheader.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qapplication.h> 29#include <qapplication.h>
30 30
31#include "kpimprefs.h" 31#include "kpimprefs.h"
32 32
33#include "categoryeditdialog.h" 33#include "categoryeditdialog.h"
34 34
35using namespace KPIM; 35using namespace KPIM;
36 36
37CategoryEditDialog::CategoryEditDialog( KPimPrefs *prefs, QWidget* parent, 37CategoryEditDialog::CategoryEditDialog( KPimPrefs *prefs, QWidget* parent,
38 const char* name, bool modal, 38 const char* name, bool modal,
39 WFlags fl ) 39 WFlags fl )
40 : CategoryEditDialog_base( parent, name, modal, fl ), 40 : CategoryEditDialog_base( parent, name, modal, fl ),
41 mPrefs( prefs ) 41 mPrefs( prefs )
42{ 42{
43 mCategories->header()->hide(); 43 mCategories->header()->hide();
44 44
45 QStringList::Iterator it; 45 QStringList::Iterator it;
46 bool categoriesExist=false; 46 bool categoriesExist=false;
47 for (it = mPrefs->mCustomCategories.begin(); 47 for (it = mPrefs->mCustomCategories.begin();
48 it != mPrefs->mCustomCategories.end(); ++it ) { 48 it != mPrefs->mCustomCategories.end(); ++it ) {
49 new QListViewItem(mCategories,*it); 49 new QListViewItem(mCategories,*it);
50 categoriesExist=true; 50 categoriesExist=true;
51 } 51 }
52 52
53 connect(mCategories,SIGNAL(selectionChanged(QListViewItem *)), 53 connect(mCategories,SIGNAL(selectionChanged(QListViewItem *)),
54 SLOT(editItem(QListViewItem *))); 54 SLOT(editItem(QListViewItem *)));
55 connect(mEdit,SIGNAL(textChanged ( const QString & )),this,SLOT(slotTextChanged(const QString &))); 55 connect(mEdit,SIGNAL(textChanged ( const QString & )),this,SLOT(slotTextChanged(const QString &)));
56 mButtonRemove->setEnabled(categoriesExist); 56 mButtonRemove->setEnabled(categoriesExist);
57 mButtonModify->setEnabled(categoriesExist); 57 mButtonModify->setEnabled(categoriesExist);
58 mButtonAdd->setEnabled(!mEdit->text().isEmpty()); 58 mButtonAdd->setEnabled(!mEdit->text().isEmpty());
59 if ( QApplication::desktop()->width() > 460 ) 59 if ( QApplication::desktop()->width() > 460 )
60 resize( 300, 360 ); 60 resize( 300, 360 );
61} 61}
62 62
63/* 63/*
64 * Destroys the object and frees any allocated resources 64 * Destroys the object and frees any allocated resources
65 */ 65 */
66CategoryEditDialog::~CategoryEditDialog() 66CategoryEditDialog::~CategoryEditDialog()
67{ 67{
68 // no need to delete child widgets, Qt does it all for us 68 // no need to delete child widgets, Qt does it all for us
69} 69}
70 70
71void CategoryEditDialog::slotTextChanged(const QString &text) 71void CategoryEditDialog::slotTextChanged(const QString &text)
72{ 72{
73 mButtonAdd->setEnabled(!text.isEmpty()); 73 mButtonAdd->setEnabled(!text.isEmpty());
74} 74}
75 75
76void CategoryEditDialog::add() 76void CategoryEditDialog::add()
77{ 77{
78 if (!mEdit->text().isEmpty()) { 78 if (!mEdit->text().isEmpty()) {
79 new QListViewItem(mCategories,mEdit->text()); 79 new QListViewItem(mCategories,mEdit->text());
80 mEdit->setText(""); 80 mEdit->setText("");
81 mButtonRemove->setEnabled(mCategories->childCount()>0); 81 mButtonRemove->setEnabled(mCategories->childCount()>0);
82 mButtonModify->setEnabled(mCategories->childCount()>0); 82 mButtonModify->setEnabled(mCategories->childCount()>0);
83 } 83 }
84} 84}
85 85
86void CategoryEditDialog::remove() 86void CategoryEditDialog::remove()
87{ 87{
88 if (mCategories->currentItem()) { 88 if (mCategories->currentItem()) {
89 delete mCategories->currentItem(); 89 delete mCategories->currentItem();
90 mButtonRemove->setEnabled(mCategories->childCount()>0); 90 mButtonRemove->setEnabled(mCategories->childCount()>0);
91 mButtonModify->setEnabled(mCategories->childCount()>0); 91 mButtonModify->setEnabled(mCategories->childCount()>0);
92 } 92 }
93} 93}
94 94
95void CategoryEditDialog::modify() 95void CategoryEditDialog::modify()
96{ 96{
97 if (!mEdit->text().isEmpty()) { 97 if (!mEdit->text().isEmpty()) {
98 if (mCategories->currentItem()) { 98 if (mCategories->currentItem()) {
99 mCategories->currentItem()->setText(0,mEdit->text()); 99 mCategories->currentItem()->setText(0,mEdit->text());
100 } 100 }
101 } 101 }
102} 102}
103void CategoryEditDialog::accept() 103void CategoryEditDialog::accept()
104{ 104{
105 slotOk(); 105 slotOk();
106} 106}
107 107
108void CategoryEditDialog::slotOk() 108void CategoryEditDialog::slotOk()
109{ 109{
110 slotApply(); 110 slotApply();
111 QDialog::accept(); 111 QDialog::accept();
112} 112}
113 113
114void CategoryEditDialog::slotApply() 114void CategoryEditDialog::slotApply()
115{ 115{
116 mPrefs->mCustomCategories.clear(); 116 mPrefs->mCustomCategories.clear();
117 117
118 QListViewItem *item = mCategories->firstChild(); 118 QListViewItem *item = mCategories->firstChild();
119 while(item) { 119 while(item) {
120 mPrefs->mCustomCategories.append(item->text(0)); 120 mPrefs->mCustomCategories.append(item->text(0));
121 item = item->nextSibling(); 121 item = item->nextSibling();
122 } 122 }
123 mPrefs->writeConfig(); 123 mPrefs->writeConfig();
124 124
125 emit categoryConfigChanged(); 125 emit categoryConfigChanged();
126} 126}
127 127
128void CategoryEditDialog::editItem(QListViewItem *item) 128void CategoryEditDialog::editItem(QListViewItem *item)
129{ 129{
130 mEdit->setText(item->text(0)); 130 mEdit->setText(item->text(0));
131 mButtonRemove->setEnabled(true); 131 mButtonRemove->setEnabled(true);
132 mButtonModify->setEnabled(true); 132 mButtonModify->setEnabled(true);
133} 133}
134 134
135#include "categoryeditdialog.moc" 135//US #include "categoryeditdialog.moc"
diff --git a/libkdepim/categoryeditdialog_base.cpp b/libkdepim/categoryeditdialog_base.cpp
index ac99190..2390bbd 100644
--- a/libkdepim/categoryeditdialog_base.cpp
+++ b/libkdepim/categoryeditdialog_base.cpp
@@ -1,154 +1,154 @@
1#include <klocale.h> 1#include <klocale.h>
2/**************************************************************************** 2/****************************************************************************
3** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryeditdialog_base.ui' 3** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryeditdialog_base.ui'
4** 4**
5** Created: Sat Mar 29 21:46:09 2003 5** Created: Sat Mar 29 21:46:09 2003
6** by: The User Interface Compiler () 6** by: The User Interface Compiler ()
7** 7**
8** WARNING! All changes made in this file will be lost! 8** WARNING! All changes made in this file will be lost!
9****************************************************************************/ 9****************************************************************************/
10 10
11#include "categoryeditdialog_base.h" 11#include "categoryeditdialog_base.h"
12 12
13#include <qvariant.h> 13#include <qvariant.h>
14#include <qheader.h> 14#include <qheader.h>
15#include <qlineedit.h> 15#include <qlineedit.h>
16#include <qlistview.h> 16#include <qlistview.h>
17#include <qpushbutton.h> 17#include <qpushbutton.h>
18#include <qlayout.h> 18#include <qlayout.h>
19#include <qtooltip.h> 19#include <qtooltip.h>
20#include <qwhatsthis.h> 20#include <qwhatsthis.h>
21 21
22/* 22/*
23 * Constructs a CategoryEditDialog_base as a child of 'parent', with the 23 * Constructs a CategoryEditDialog_base as a child of 'parent', with the
24 * name 'name' and widget flags set to 'f'. 24 * name 'name' and widget flags set to 'f'.
25 * 25 *
26 * The dialog will by default be modeless, unless you set 'modal' to 26 * The dialog will by default be modeless, unless you set 'modal' to
27 * TRUE to construct a modal dialog. 27 * TRUE to construct a modal dialog.
28 */ 28 */
29CategoryEditDialog_base::CategoryEditDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) 29CategoryEditDialog_base::CategoryEditDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl )
30 : QDialog( parent, name, true, fl ) 30 : QDialog( parent, name, true, fl )
31 31
32{ 32{
33 if ( !name ) 33 if ( !name )
34 setName( "CategoryEditDialog_base" ); 34 setName( "CategoryEditDialog_base" );
35 CategoryEditDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "CategoryEditDialog_baseLayout"); 35 CategoryEditDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "CategoryEditDialog_baseLayout");
36 36
37 mEdit = new QLineEdit( this, "mEdit" ); 37 mEdit = new QLineEdit( this, "mEdit" );
38 38
39 CategoryEditDialog_baseLayout->addMultiCellWidget( mEdit, 1, 1, 0, 1 ); 39 CategoryEditDialog_baseLayout->addMultiCellWidget( mEdit, 1, 1, 0, 1 );
40 40
41 Layout13 = new QHBoxLayout( 0, 0, 6, "Layout13"); 41 Layout13 = new QHBoxLayout( 0, 0, 6, "Layout13");
42 42
43 // mButtonHelp = new QPushButton( this, "mButtonHelp" ); 43 // mButtonHelp = new QPushButton( this, "mButtonHelp" );
44 //mButtonHelp->setAutoDefault( TRUE ); 44 //mButtonHelp->setAutoDefault( TRUE );
45 //Layout13->addWidget( mButtonHelp ); 45 //Layout13->addWidget( mButtonHelp );
46 //QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); 46 //QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
47 //Layout13->addItem( spacer ); 47 //Layout13->addItem( spacer );
48 48
49 //mApply = new QPushButton( this, "mApply" ); 49 //mApply = new QPushButton( this, "mApply" );
50 // Layout13->addWidget( mApply ); 50 // Layout13->addWidget( mApply );
51 51
52 mButtonOk = new QPushButton( this, "mButtonOk" ); 52 mButtonOk = new QPushButton( this, "mButtonOk" );
53 mButtonOk->setAutoDefault( TRUE ); 53 mButtonOk->setAutoDefault( TRUE );
54 mButtonOk->setDefault( TRUE ); 54 mButtonOk->setDefault( TRUE );
55 Layout13->addWidget( mButtonOk ); 55 Layout13->addWidget( mButtonOk );
56 56
57 mButtonCancel = new QPushButton( this, "mButtonCancel" ); 57 mButtonCancel = new QPushButton( this, "mButtonCancel" );
58 mButtonCancel->setAutoDefault( TRUE ); 58 mButtonCancel->setAutoDefault( TRUE );
59 Layout13->addWidget( mButtonCancel ); 59 Layout13->addWidget( mButtonCancel );
60 60
61 CategoryEditDialog_baseLayout->addMultiCellLayout( Layout13, 2, 2, 0, 1 ); 61 CategoryEditDialog_baseLayout->addMultiCellLayout( Layout13, 2, 2, 0, 1 );
62 62
63 mCategories = new QListView( this, "mCategories" ); 63 mCategories = new QListView( this, "mCategories" );
64 mCategories->addColumn( tr2i18n( "Category" ) ); 64 mCategories->addColumn( tr2i18n( "Category" ) );
65 65
66 CategoryEditDialog_baseLayout->addWidget( mCategories, 0, 0 ); 66 CategoryEditDialog_baseLayout->addWidget( mCategories, 0, 0 );
67 67
68 layout103 = new QVBoxLayout( 0, 0, 6, "layout103"); 68 layout103 = new QVBoxLayout( 0, 0, 6, "layout103");
69 69
70 mButtonAdd = new QPushButton( this, "mButtonAdd" ); 70 mButtonAdd = new QPushButton( this, "mButtonAdd" );
71 layout103->addWidget( mButtonAdd ); 71 layout103->addWidget( mButtonAdd );
72 72
73 mButtonModify = new QPushButton( this, "mButtonModify" ); 73 mButtonModify = new QPushButton( this, "mButtonModify" );
74 layout103->addWidget( mButtonModify ); 74 layout103->addWidget( mButtonModify );
75 75
76 mButtonRemove = new QPushButton( this, "mButtonRemove" ); 76 mButtonRemove = new QPushButton( this, "mButtonRemove" );
77 layout103->addWidget( mButtonRemove ); 77 layout103->addWidget( mButtonRemove );
78 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 78 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
79 layout103->addItem( spacer_2 ); 79 layout103->addItem( spacer_2 );
80 80
81 CategoryEditDialog_baseLayout->addLayout( layout103, 0, 1 ); 81 CategoryEditDialog_baseLayout->addLayout( layout103, 0, 1 );
82 languageChange(); 82 languageChange();
83 resize( sizeHint() ); 83 resize( sizeHint() );
84 84
85 // signals and slots connections 85 // signals and slots connections
86 connect( mButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); 86 connect( mButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
87 connect( mButtonAdd, SIGNAL( clicked() ), this, SLOT( add() ) ); 87 connect( mButtonAdd, SIGNAL( clicked() ), this, SLOT( add() ) );
88 connect( mButtonModify, SIGNAL( clicked() ), this, SLOT( modify() ) ); 88 connect( mButtonModify, SIGNAL( clicked() ), this, SLOT( modify() ) );
89 connect( mButtonRemove, SIGNAL( clicked() ), this, SLOT( remove() ) ); 89 connect( mButtonRemove, SIGNAL( clicked() ), this, SLOT( remove() ) );
90 connect( mButtonOk, SIGNAL( clicked() ), this, SLOT( slotOk() ) ); 90 connect( mButtonOk, SIGNAL( clicked() ), this, SLOT( slotOk() ) );
91 //connect( mApply, SIGNAL( clicked() ), this, SLOT( slotApply() ) ); 91 //connect( mApply, SIGNAL( clicked() ), this, SLOT( slotApply() ) );
92 92
93 // tab order 93 // tab order
94 // setTabOrder( mCategories, mEdit ); 94 // setTabOrder( mCategories, mEdit );
95// setTabOrder( mEdit, mButtonAdd ); 95// setTabOrder( mEdit, mButtonAdd );
96// setTabOrder( mButtonAdd, mButtonModify ); 96// setTabOrder( mButtonAdd, mButtonModify );
97// setTabOrder( mButtonModify, mButtonRemove ); 97// setTabOrder( mButtonModify, mButtonRemove );
98// setTabOrder( mButtonRemove, mButtonHelp ); 98// setTabOrder( mButtonRemove, mButtonHelp );
99// setTabOrder( mButtonHelp, mApply ); 99// setTabOrder( mButtonHelp, mApply );
100// setTabOrder( mApply, mButtonOk ); 100// setTabOrder( mApply, mButtonOk );
101// setTabOrder( mButtonOk, mButtonCancel ); 101// setTabOrder( mButtonOk, mButtonCancel );
102} 102}
103 103
104/* 104/*
105 * Destroys the object and frees any allocated resources 105 * Destroys the object and frees any allocated resources
106 */ 106 */
107CategoryEditDialog_base::~CategoryEditDialog_base() 107CategoryEditDialog_base::~CategoryEditDialog_base()
108{ 108{
109 // no need to delete child widgets, Qt does it all for us 109 // no need to delete child widgets, Qt does it all for us
110} 110}
111 111
112/* 112/*
113 * Sets the strings of the subwidgets using the current 113 * Sets the strings of the subwidgets using the current
114 * language. 114 * language.
115 */ 115 */
116void CategoryEditDialog_base::languageChange() 116void CategoryEditDialog_base::languageChange()
117{ 117{
118 setCaption( tr2i18n( "Edit Categories" ) ); 118 setCaption( tr2i18n( "Edit Categories" ) );
119 // mButtonHelp->setText( tr2i18n( "&Help" ) ); 119 // mButtonHelp->setText( tr2i18n( "&Help" ) );
120 // mApply->setText( tr2i18n( "&Apply" ) ); 120 // mApply->setText( tr2i18n( "&Apply" ) );
121 mButtonOk->setText( tr2i18n( "&OK" ) ); 121 mButtonOk->setText( tr2i18n( "&OK" ) );
122 mButtonCancel->setText( tr2i18n( "&Cancel" ) ); 122 mButtonCancel->setText( tr2i18n( "&Cancel" ) );
123 mCategories->header()->setLabel( 0, tr2i18n( "Category" ) ); 123 mCategories->header()->setLabel( 0, tr2i18n( "Category" ) );
124 mButtonAdd->setText( tr2i18n( "A&dd" ) ); 124 mButtonAdd->setText( tr2i18n( "A&dd" ) );
125 mButtonModify->setText( tr2i18n( "&Modify" ) ); 125 mButtonModify->setText( tr2i18n( "&Modify" ) );
126 mButtonRemove->setText( tr2i18n( "&Remove" ) ); 126 mButtonRemove->setText( tr2i18n( "&Remove" ) );
127} 127}
128 128
129void CategoryEditDialog_base::add() 129void CategoryEditDialog_base::add()
130{ 130{
131 qWarning( "CategoryEditDialog_base::add(): Not implemented yet" ); 131 qWarning( "CategoryEditDialog_base::add(): Not implemented yet" );
132} 132}
133 133
134void CategoryEditDialog_base::modify() 134void CategoryEditDialog_base::modify()
135{ 135{
136 qWarning( "CategoryEditDialog_base::modify(): Not implemented yet" ); 136 qWarning( "CategoryEditDialog_base::modify(): Not implemented yet" );
137} 137}
138 138
139void CategoryEditDialog_base::slotApply() 139void CategoryEditDialog_base::slotApply()
140{ 140{
141 qWarning( "CategoryEditDialog_base::slotApply(): Not implemented yet" ); 141 qWarning( "CategoryEditDialog_base::slotApply(): Not implemented yet" );
142} 142}
143 143
144void CategoryEditDialog_base::remove() 144void CategoryEditDialog_base::remove()
145{ 145{
146 qWarning( "CategoryEditDialog_base::remove(): Not implemented yet" ); 146 qWarning( "CategoryEditDialog_base::remove(): Not implemented yet" );
147} 147}
148 148
149void CategoryEditDialog_base::slotOk() 149void CategoryEditDialog_base::slotOk()
150{ 150{
151 qWarning( "CategoryEditDialog_base::slotOk(): Not implemented yet" ); 151 qWarning( "CategoryEditDialog_base::slotOk(): Not implemented yet" );
152} 152}
153 153
154#include "categoryeditdialog_base.moc" 154//US #include "categoryeditdialog_base.moc"
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp
index 7b0aced..943d35c 100644
--- a/libkdepim/categoryselectdialog.cpp
+++ b/libkdepim/categoryselectdialog.cpp
@@ -1,173 +1,173 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlistview.h> 24#include <qlistview.h>
25#include <qpushbutton.h> 25#include <qpushbutton.h>
26#include <qheader.h> 26#include <qheader.h>
27#include <qapp.h> 27#include <qapp.h>
28#include <qmessagebox.h> 28#include <qmessagebox.h>
29 29
30 30
31#include <libkdepim/categoryeditdialog.h> 31#include <libkdepim/categoryeditdialog.h>
32#include "categoryselectdialog.h" 32#include "categoryselectdialog.h"
33 33
34#include "kpimprefs.h" 34#include "kpimprefs.h"
35 35
36using namespace KPIM; 36using namespace KPIM;
37 37
38CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, 38CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent,
39 const char* name, 39 const char* name,
40 bool modal, WFlags fl ) 40 bool modal, WFlags fl )
41 : CategorySelectDialog_base( parent, name, true, fl ), 41 : CategorySelectDialog_base( parent, name, true, fl ),
42 mPrefs( prefs ) 42 mPrefs( prefs )
43{ 43{
44 mCategories->header()->hide(); 44 mCategories->header()->hide();
45 45
46 setCategories(); 46 setCategories();
47 47
48 connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog())); 48 connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog()));
49 if ( qApp->desktop()->height() < 321 ) 49 if ( qApp->desktop()->height() < 321 )
50 setMaximumHeight( QApplication::desktop()->height() - 50 ); 50 setMaximumHeight( QApplication::desktop()->height() - 50 );
51 else 51 else
52 setMaximumHeight( QApplication::desktop()->height() - 80 ); 52 setMaximumHeight( QApplication::desktop()->height() - 80 );
53 if ( QApplication::desktop()->width() > 460 ) 53 if ( QApplication::desktop()->width() > 460 )
54 resize( 260, 360 ); 54 resize( 260, 360 );
55} 55}
56void CategorySelectDialog::editCategoriesDialog() 56void CategorySelectDialog::editCategoriesDialog()
57{ 57{
58 KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); 58 KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this );
59 59
60 ced->exec(); 60 ced->exec();
61 delete ced; 61 delete ced;
62 setCategories(); 62 setCategories();
63} 63}
64void CategorySelectDialog::setCategories() 64void CategorySelectDialog::setCategories()
65{ 65{
66 mCategories->clear(); 66 mCategories->clear();
67 mCategoryList.clear(); 67 mCategoryList.clear();
68 68
69 QStringList::Iterator it; 69 QStringList::Iterator it;
70 70
71 for (it = mPrefs->mCustomCategories.begin(); 71 for (it = mPrefs->mCustomCategories.begin();
72 it != mPrefs->mCustomCategories.end(); ++it ) { 72 it != mPrefs->mCustomCategories.end(); ++it ) {
73 new QCheckListItem(mCategories,*it,QCheckListItem::CheckBox); 73 new QCheckListItem(mCategories,*it,QCheckListItem::CheckBox);
74 } 74 }
75} 75}
76 76
77CategorySelectDialog::~CategorySelectDialog() 77CategorySelectDialog::~CategorySelectDialog()
78{ 78{
79} 79}
80 80
81void CategorySelectDialog::setSelected(const QStringList &selList) 81void CategorySelectDialog::setSelected(const QStringList &selList)
82{ 82{
83 clear(); 83 clear();
84 84
85 QStringList::ConstIterator it; 85 QStringList::ConstIterator it;
86 QStringList notFound; 86 QStringList notFound;
87 bool found = false; 87 bool found = false;
88 for (it=selList.begin();it!=selList.end();++it) { 88 for (it=selList.begin();it!=selList.end();++it) {
89 //qDebug(" CategorySelectDialog::setSelected("); 89 //qDebug(" CategorySelectDialog::setSelected(");
90 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 90 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
91 while (item) { 91 while (item) {
92 if (item->text() == *it) { 92 if (item->text() == *it) {
93 item->setOn(true); 93 item->setOn(true);
94 found = true; 94 found = true;
95 break; 95 break;
96 } 96 }
97 item = (QCheckListItem *)item->nextSibling(); 97 item = (QCheckListItem *)item->nextSibling();
98 } 98 }
99// if ( ! found ) { 99// if ( ! found ) {
100 100
101//emit updateCategoriesGlobal(); 101//emit updateCategoriesGlobal();
102// QMessageBox::information( this, "KO/E: Information!", 102// QMessageBox::information( this, "KO/E: Information!",
103// "Categories found, which were not\n" 103// "Categories found, which were not\n"
104// "in list of categories!\n" 104// "in list of categories!\n"
105// "message", 105// "message",
106// "OK", "", 0, 106// "OK", "", 0,
107// 0, 1 ); 107// 0, 1 );
108// setSelected(selList); 108// setSelected(selList);
109// return; 109// return;
110// } 110// }
111 } 111 }
112} 112}
113 113
114QStringList CategorySelectDialog::selectedCategories() const 114QStringList CategorySelectDialog::selectedCategories() const
115{ 115{
116 return mCategoryList; 116 return mCategoryList;
117} 117}
118 118
119void CategorySelectDialog::slotApply() 119void CategorySelectDialog::slotApply()
120{ 120{
121 QStringList categories; 121 QStringList categories;
122 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 122 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
123 while (item) { 123 while (item) {
124 if (item->isOn()) { 124 if (item->isOn()) {
125 categories.append(item->text()); 125 categories.append(item->text());
126 } 126 }
127 item = (QCheckListItem *)item->nextSibling(); 127 item = (QCheckListItem *)item->nextSibling();
128 } 128 }
129 129
130 QString categoriesStr = categories.join(","); 130 QString categoriesStr = categories.join(",");
131 131
132 mCategoryList = categories; 132 mCategoryList = categories;
133 133
134 emit categoriesSelected(categories); 134 emit categoriesSelected(categories);
135 emit categoriesSelected(categoriesStr); 135 emit categoriesSelected(categoriesStr);
136} 136}
137void CategorySelectDialog::accept() 137void CategorySelectDialog::accept()
138{ 138{
139 slotOk(); 139 slotOk();
140} 140}
141 141
142void CategorySelectDialog::slotOk() 142void CategorySelectDialog::slotOk()
143{ 143{
144 slotApply(); 144 slotApply();
145 QDialog::accept(); 145 QDialog::accept();
146} 146}
147 147
148void CategorySelectDialog::clear() 148void CategorySelectDialog::clear()
149{ 149{
150 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 150 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
151 while (item) { 151 while (item) {
152 item->setOn(false); 152 item->setOn(false);
153 item = (QCheckListItem *)item->nextSibling(); 153 item = (QCheckListItem *)item->nextSibling();
154 } 154 }
155} 155}
156 156
157void CategorySelectDialog::updateCategoryConfig() 157void CategorySelectDialog::updateCategoryConfig()
158{ 158{
159 QStringList selected; 159 QStringList selected;
160 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 160 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
161 while (item) { 161 while (item) {
162 if (item->isOn()) { 162 if (item->isOn()) {
163 selected.append(item->text()); 163 selected.append(item->text());
164 } 164 }
165 item = (QCheckListItem *)item->nextSibling(); 165 item = (QCheckListItem *)item->nextSibling();
166 } 166 }
167 167
168 setCategories(); 168 setCategories();
169 169
170 setSelected(selected); 170 setSelected(selected);
171} 171}
172 172
173#include "categoryselectdialog.moc" 173//#include "categoryselectdialog.moc"
diff --git a/libkdepim/categoryselectdialog_base.cpp b/libkdepim/categoryselectdialog_base.cpp
index 5e5fa72..3f050cf 100644
--- a/libkdepim/categoryselectdialog_base.cpp
+++ b/libkdepim/categoryselectdialog_base.cpp
@@ -1,128 +1,128 @@
1#include <klocale.h> 1#include <klocale.h>
2/**************************************************************************** 2/****************************************************************************
3** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryselectdialog_base.ui' 3** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryselectdialog_base.ui'
4** 4**
5** Created: Sat Mar 29 21:46:05 2003 5** Created: Sat Mar 29 21:46:05 2003
6** by: The User Interface Compiler () 6** by: The User Interface Compiler ()
7** 7**
8** WARNING! All changes made in this file will be lost! 8** WARNING! All changes made in this file will be lost!
9****************************************************************************/ 9****************************************************************************/
10 10
11#include "categoryselectdialog_base.h" 11#include "categoryselectdialog_base.h"
12 12
13#include <qvariant.h> 13#include <qvariant.h>
14#include <qheader.h> 14#include <qheader.h>
15#include <qlistview.h> 15#include <qlistview.h>
16#include <qpushbutton.h> 16#include <qpushbutton.h>
17#include <qlayout.h> 17#include <qlayout.h>
18#include <qtooltip.h> 18#include <qtooltip.h>
19#include <qwhatsthis.h> 19#include <qwhatsthis.h>
20 20
21/* 21/*
22 * Constructs a CategorySelectDialog_base as a child of 'parent', with the 22 * Constructs a CategorySelectDialog_base as a child of 'parent', with the
23 * name 'name' and widget flags set to 'f'. 23 * name 'name' and widget flags set to 'f'.
24 * 24 *
25 * The dialog will by default be modeless, unless you set 'modal' to 25 * The dialog will by default be modeless, unless you set 'modal' to
26 * TRUE to construct a modal dialog. 26 * TRUE to construct a modal dialog.
27 */ 27 */
28CategorySelectDialog_base::CategorySelectDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) 28CategorySelectDialog_base::CategorySelectDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl )
29 : QDialog( parent, name, modal, fl ) 29 : QDialog( parent, name, modal, fl )
30 30
31{ 31{
32 if ( !name ) 32 if ( !name )
33 setName( "CategorySelectDialog_base" ); 33 setName( "CategorySelectDialog_base" );
34 CategorySelectDialog_baseLayout = new QVBoxLayout( this, 11, 6, "CategorySelectDialog_baseLayout"); 34 CategorySelectDialog_baseLayout = new QVBoxLayout( this, 11, 6, "CategorySelectDialog_baseLayout");
35 35
36 mCategories = new QListView( this, "mCategories" ); 36 mCategories = new QListView( this, "mCategories" );
37 mCategories->addColumn( i18n( "Category" ) ); 37 mCategories->addColumn( i18n( "Category" ) );
38 CategorySelectDialog_baseLayout->addWidget( mCategories ); 38 CategorySelectDialog_baseLayout->addWidget( mCategories );
39 39
40 Layout12 = new QHBoxLayout( 0, 0, 6, "Layout12"); 40 Layout12 = new QHBoxLayout( 0, 0, 6, "Layout12");
41 41
42 mClear = new QPushButton( this, "mClear" ); 42 mClear = new QPushButton( this, "mClear" );
43 Layout12->addWidget( mClear ); 43 Layout12->addWidget( mClear );
44 // QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); 44 // QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
45 //Layout12->addItem( spacer ); 45 //Layout12->addItem( spacer );
46 46
47 mButtonEdit = new QPushButton( this, "mButtonEdit" ); 47 mButtonEdit = new QPushButton( this, "mButtonEdit" );
48 Layout12->addWidget( mButtonEdit ); 48 Layout12->addWidget( mButtonEdit );
49 CategorySelectDialog_baseLayout->addLayout( Layout12 ); 49 CategorySelectDialog_baseLayout->addLayout( Layout12 );
50 50
51 Layout11 = new QHBoxLayout( 0, 0, 6, "Layout11"); 51 Layout11 = new QHBoxLayout( 0, 0, 6, "Layout11");
52 52
53 //mButtonHelp = new QPushButton( this, "mButtonHelp" ); 53 //mButtonHelp = new QPushButton( this, "mButtonHelp" );
54 //Layout11->addWidget( mButtonHelp ); 54 //Layout11->addWidget( mButtonHelp );
55 //QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); 55 //QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
56 // Layout11->addItem( spacer_2 ); 56 // Layout11->addItem( spacer_2 );
57 57
58 //mApply = new QPushButton( this, "mApply" ); 58 //mApply = new QPushButton( this, "mApply" );
59 // Layout11->addWidget( mApply ); 59 // Layout11->addWidget( mApply );
60 60
61 mButtonOk = new QPushButton( this, "mButtonOk" ); 61 mButtonOk = new QPushButton( this, "mButtonOk" );
62 mButtonOk->setOn( FALSE ); 62 mButtonOk->setOn( FALSE );
63 mButtonOk->setDefault( TRUE ); 63 mButtonOk->setDefault( TRUE );
64 Layout11->addWidget( mButtonOk ); 64 Layout11->addWidget( mButtonOk );
65 65
66 mButtonCancel = new QPushButton( this, "mButtonCancel" ); 66 mButtonCancel = new QPushButton( this, "mButtonCancel" );
67 Layout11->addWidget( mButtonCancel ); 67 Layout11->addWidget( mButtonCancel );
68 CategorySelectDialog_baseLayout->addLayout( Layout11 ); 68 CategorySelectDialog_baseLayout->addLayout( Layout11 );
69 languageChange(); 69 languageChange();
70 // resize( sizeHint() ); 70 // resize( sizeHint() );
71 71
72 // signals and slots connections 72 // signals and slots connections
73 connect( mButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); 73 connect( mButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
74 connect( mButtonOk, SIGNAL( clicked() ), this, SLOT( slotOk() ) ); 74 connect( mButtonOk, SIGNAL( clicked() ), this, SLOT( slotOk() ) );
75 connect( mClear, SIGNAL( clicked() ), this, SLOT( clear() ) ); 75 connect( mClear, SIGNAL( clicked() ), this, SLOT( clear() ) );
76 //connect( mApply, SIGNAL( clicked() ), this, SLOT( slotApply() ) ); 76 //connect( mApply, SIGNAL( clicked() ), this, SLOT( slotApply() ) );
77 77
78 // tab order 78 // tab order
79 setTabOrder( mCategories, mClear ); 79 setTabOrder( mCategories, mClear );
80 setTabOrder( mClear, mButtonEdit ); 80 setTabOrder( mClear, mButtonEdit );
81 setTabOrder( mButtonEdit, mButtonOk );//mButtonHelp ); 81 setTabOrder( mButtonEdit, mButtonOk );//mButtonHelp );
82 // setTabOrder( mButtonHelp, mApply ); 82 // setTabOrder( mButtonHelp, mApply );
83 // setTabOrder( mApply, mButtonOk ); 83 // setTabOrder( mApply, mButtonOk );
84 setTabOrder( mButtonOk, mButtonCancel ); 84 setTabOrder( mButtonOk, mButtonCancel );
85 // showMaximized(); 85 // showMaximized();
86 //raise(); 86 //raise();
87} 87}
88 88
89/* 89/*
90 * Destroys the object and frees any allocated resources 90 * Destroys the object and frees any allocated resources
91 */ 91 */
92CategorySelectDialog_base::~CategorySelectDialog_base() 92CategorySelectDialog_base::~CategorySelectDialog_base()
93{ 93{
94 // no need to delete child widgets, Qt does it all for us 94 // no need to delete child widgets, Qt does it all for us
95} 95}
96 96
97/* 97/*
98 * Sets the strings of the subwidgets using the current 98 * Sets the strings of the subwidgets using the current
99 * language. 99 * language.
100 */ 100 */
101void CategorySelectDialog_base::languageChange() 101void CategorySelectDialog_base::languageChange()
102{ 102{
103 setCaption( i18n( "Select Categories" ) ); 103 setCaption( i18n( "Select Categories" ) );
104 mCategories->header()->setLabel( 0, tr2i18n( "Category" ) ); 104 mCategories->header()->setLabel( 0, tr2i18n( "Category" ) );
105 mClear->setText( i18n( " &Deselect All " ) ); 105 mClear->setText( i18n( " &Deselect All " ) );
106 mButtonEdit->setText( i18n( " &Edit Categories " ) ); 106 mButtonEdit->setText( i18n( " &Edit Categories " ) );
107 // mButtonHelp->setText( tr2i18n( "&Help" ) ); 107 // mButtonHelp->setText( tr2i18n( "&Help" ) );
108 //mApply->setText( i18n( "&Apply" ) ); 108 //mApply->setText( i18n( "&Apply" ) );
109 mButtonOk->setText( i18n( "&OK" ) ); 109 mButtonOk->setText( i18n( "&OK" ) );
110 mButtonCancel->setText( i18n( "&Cancel" ) ); 110 mButtonCancel->setText( i18n( "&Cancel" ) );
111} 111}
112 112
113void CategorySelectDialog_base::clear() 113void CategorySelectDialog_base::clear()
114{ 114{
115 qWarning( "CategorySelectDialog_base::clear(): Not implemented yet" ); 115 qWarning( "CategorySelectDialog_base::clear(): Not implemented yet" );
116} 116}
117 117
118void CategorySelectDialog_base::slotApply() 118void CategorySelectDialog_base::slotApply()
119{ 119{
120 qWarning( "CategorySelectDialog_base::slotApply(): Not implemented yet" ); 120 qWarning( "CategorySelectDialog_base::slotApply(): Not implemented yet" );
121} 121}
122 122
123void CategorySelectDialog_base::slotOk() 123void CategorySelectDialog_base::slotOk()
124{ 124{
125 qWarning( "CategorySelectDialog_base::slotOk(): Not implemented yet" ); 125 qWarning( "CategorySelectDialog_base::slotOk(): Not implemented yet" );
126} 126}
127 127
128#include "categoryselectdialog_base.moc" 128//US#include "categoryselectdialog_base.moc"
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp
index 60bd2cf..5fb948a 100644
--- a/libkdepim/kdateedit.cpp
+++ b/libkdepim/kdateedit.cpp
@@ -1,425 +1,425 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 3
4 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qapplication.h> 25#include <qapplication.h>
26#include <qevent.h> 26#include <qevent.h>
27#include <qlineedit.h> 27#include <qlineedit.h>
28#include <qpixmap.h> 28#include <qpixmap.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30 30
31#include <kdatepicker.h> 31#include <kdatepicker.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include <kglobal.h> 33#include <kglobal.h>
34#include <kiconloader.h> 34#include <kiconloader.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kmessagebox.h> 36#include <kmessagebox.h>
37#include <knotifyclient.h> 37#include <knotifyclient.h>
38#include <qpalette.h> 38#include <qpalette.h>
39 39
40#include "kdateedit.h" 40#include "kdateedit.h"
41#include "kdateedit.moc" 41//#include "kdateedit.moc"
42 42
43KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) 43KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP )
44 : QHBox(parent, name) 44 : QHBox(parent, name)
45{ 45{
46 dateFormShort = true; 46 dateFormShort = true;
47 withoutDp = withoutDP; 47 withoutDp = withoutDP;
48 mDateEdit = new QLineEdit(this); 48 mDateEdit = new QLineEdit(this);
49 mDateEdit->setText(KGlobal::locale()->formatDate(QDate::currentDate(),dateFormShort)); 49 mDateEdit->setText(KGlobal::locale()->formatDate(QDate::currentDate(),dateFormShort));
50 setFocusProxy(mDateEdit); 50 setFocusProxy(mDateEdit);
51 mDateEdit->installEventFilter(this); 51 mDateEdit->installEventFilter(this);
52 52
53 // Highlight Background and Textcolor 53 // Highlight Background and Textcolor
54 QPalette palette = QWidget::palette(); 54 QPalette palette = QWidget::palette();
55 unsigned char red, green, blue; 55 unsigned char red, green, blue;
56 red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; 56 red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10;
57 green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; 57 green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10;
58 blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; 58 blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10;
59 palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); 59 palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) );
60 palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); 60 palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) );
61 mDateEdit->setPalette( palette ); 61 mDateEdit->setPalette( palette );
62 62
63 if ( withoutDP ) { 63 if ( withoutDP ) {
64 mDateFrame = 0; 64 mDateFrame = 0;
65 mDateButton = 0; 65 mDateButton = 0;
66 mDatePicker = 0; 66 mDatePicker = 0;
67 } else { 67 } else {
68 QPixmap pixmap = SmallIcon("smallcal"); 68 QPixmap pixmap = SmallIcon("smallcal");
69 mDateButton = new QPushButton(this); 69 mDateButton = new QPushButton(this);
70 mDateButton->setPixmap(pixmap); 70 mDateButton->setPixmap(pixmap);
71 71
72 mDateFrame = new QVBox(0,0,WType_Popup); 72 mDateFrame = new QVBox(0,0,WType_Popup);
73 // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 73 // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
74 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 74 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
75 mDateFrame->setLineWidth(3); 75 mDateFrame->setLineWidth(3);
76 mDateFrame->hide(); 76 mDateFrame->hide();
77 77
78 mDatePicker = new KDatePicker(mDateFrame,QDate::currentDate()); 78 mDatePicker = new KDatePicker(mDateFrame,QDate::currentDate());
79 connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate))); 79 connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate)));
80 connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate))); 80 connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate)));
81 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate))); 81 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate)));
82 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate))); 82 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate)));
83 connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide())); 83 connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide()));
84 connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker())); 84 connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker()));
85 85
86 //mDateFrame->resize( 400, 300 ); 86 //mDateFrame->resize( 400, 300 );
87 87
88 } 88 }
89 connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed())); 89 connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed()));
90 connect(mDateEdit,SIGNAL(textChanged(const QString &)), 90 connect(mDateEdit,SIGNAL(textChanged(const QString &)),
91 SLOT(textChanged(const QString &))); 91 SLOT(textChanged(const QString &)));
92 92
93 // Create the keyword list. This will be used to match against when the user 93 // Create the keyword list. This will be used to match against when the user
94 // enters information. 94 // enters information.
95 mKeywordMap[i18n("tomorrow")] = 1; 95 mKeywordMap[i18n("tomorrow")] = 1;
96 mKeywordMap[i18n("today")] = 0; 96 mKeywordMap[i18n("today")] = 0;
97 mKeywordMap[i18n("yesterday")] = -1; 97 mKeywordMap[i18n("yesterday")] = -1;
98 98
99 /* 99 /*
100 * This loop uses some math tricks to figure out the offset in days 100 * This loop uses some math tricks to figure out the offset in days
101 * to the next date the given day of the week occurs. There 101 * to the next date the given day of the week occurs. There
102 * are two cases, that the new day is >= the current day, which means 102 * are two cases, that the new day is >= the current day, which means
103 * the new day has not occured yet or that the new day < the current day, 103 * the new day has not occured yet or that the new day < the current day,
104 * which means the new day is already passed (so we need to find the 104 * which means the new day is already passed (so we need to find the
105 * day in the next week). 105 * day in the next week).
106 */ 106 */
107 QString dayName; 107 QString dayName;
108 int currentDay = QDate::currentDate().dayOfWeek(); 108 int currentDay = QDate::currentDate().dayOfWeek();
109 for (int i = 1; i <= 7; ++i) 109 for (int i = 1; i <= 7; ++i)
110 { 110 {
111 dayName = KGlobal::locale()->weekDayName(i).lower(); 111 dayName = KGlobal::locale()->weekDayName(i).lower();
112 if (i >= currentDay) 112 if (i >= currentDay)
113 mKeywordMap[dayName] = i - currentDay; 113 mKeywordMap[dayName] = i - currentDay;
114 else 114 else
115 mKeywordMap[dayName] = 7 - currentDay + i; 115 mKeywordMap[dayName] = 7 - currentDay + i;
116 } 116 }
117 117
118 mTextChanged = false; 118 mTextChanged = false;
119 mHandleInvalid = false; 119 mHandleInvalid = false;
120 QWidget::setTabOrder( mDateEdit, mDateButton ); 120 QWidget::setTabOrder( mDateEdit, mDateButton );
121} 121}
122 122
123KDateEdit::~KDateEdit() 123KDateEdit::~KDateEdit()
124{ 124{
125 delete mDateFrame; 125 delete mDateFrame;
126} 126}
127 127
128void KDateEdit::setDate(QDate newDate) 128void KDateEdit::setDate(QDate newDate)
129{ 129{
130 if (!newDate.isValid() && !mHandleInvalid) 130 if (!newDate.isValid() && !mHandleInvalid)
131 return; 131 return;
132 if ( readDate() == newDate ) 132 if ( readDate() == newDate )
133 return; 133 return;
134 QString dateString = ""; 134 QString dateString = "";
135 if(newDate.isValid()) 135 if(newDate.isValid())
136 dateString = KGlobal::locale()->formatDate( newDate, dateFormShort ); 136 dateString = KGlobal::locale()->formatDate( newDate, dateFormShort );
137 137
138 mTextChanged = false; 138 mTextChanged = false;
139 139
140 // We do not want to generate a signal here, since we explicity setting 140 // We do not want to generate a signal here, since we explicity setting
141 // the date 141 // the date
142 bool b = mDateEdit->signalsBlocked(); 142 bool b = mDateEdit->signalsBlocked();
143 mDateEdit->blockSignals(true); 143 mDateEdit->blockSignals(true);
144 mDateEdit->setText(dateString); 144 mDateEdit->setText(dateString);
145 mDateEdit->blockSignals(b); 145 mDateEdit->blockSignals(b);
146} 146}
147 147
148void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateFormShort) 148void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateFormShort)
149{ 149{
150 QString dateForm = dateFormShort ? 150 QString dateForm = dateFormShort ?
151 KGlobal::locale()->dateFormatShort() : 151 KGlobal::locale()->dateFormatShort() :
152 KGlobal::locale()->dateFormat(); 152 KGlobal::locale()->dateFormat();
153 153
154 int begin = dateForm.find("%"); 154 int begin = dateForm.find("%");
155 int space = 0; 155 int space = 0;
156 int allStrLength = 0; 156 int allStrLength = 0;
157 int strLength = 0; 157 int strLength = 0;
158 int repeat = 0; 158 int repeat = 0;
159 159
160 // witch? Day, Month or Year switch? 160 // witch? Day, Month or Year switch?
161 while(1){ 161 while(1){
162 switch ( dateForm.at(begin + 1).latin1() ) 162 switch ( dateForm.at(begin + 1).latin1() )
163 { 163 {
164 case 'd':// 16 (month day) 164 case 'd':// 16 (month day)
165 strLength = 2; //Ok 165 strLength = 2; //Ok
166 break; 166 break;
167 case 'm':// 01 (month) 167 case 'm':// 01 (month)
168 strLength = 2; //Ok 168 strLength = 2; //Ok
169 break; 169 break;
170 case 'a':// Mon (Weekday) 170 case 'a':// Mon (Weekday)
171 strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length(); 171 strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length();
172 break; 172 break;
173 case 'A':// Monday (Weekday) 173 case 'A':// Monday (Weekday)
174 strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length(); 174 strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length();
175 break; 175 break;
176 case 'b':// Jan (monthName) 176 case 'b':// Jan (monthName)
177 strLength = KGlobal::locale()->monthName(date.month(), true).length(); 177 strLength = KGlobal::locale()->monthName(date.month(), true).length();
178 break; 178 break;
179 case 'B':// January (monthName) 179 case 'B':// January (monthName)
180 strLength = KGlobal::locale()->monthName(date.month(), false).length(); 180 strLength = KGlobal::locale()->monthName(date.month(), false).length();
181 break; 181 break;
182 case 'y':// 04 (year short) 182 case 'y':// 04 (year short)
183 strLength = 2; //Ok 183 strLength = 2; //Ok
184 break; 184 break;
185 case 'Y':// 2004 (year) 185 case 'Y':// 2004 (year)
186 strLength = 4; //Ok 186 strLength = 4; //Ok
187 break; 187 break;
188 default: 188 default:
189 break; 189 break;
190 } 190 }
191 space = begin - (repeat++ * 2); 191 space = begin - (repeat++ * 2);
192 // all select? then dayswitch 192 // all select? then dayswitch
193 if( (mDateEdit->text().length() == mDateEdit->markedText().length() ) && 193 if( (mDateEdit->text().length() == mDateEdit->markedText().length() ) &&
194 ( (dateForm.at(begin + 1).latin1() == 'd') || 194 ( (dateForm.at(begin + 1).latin1() == 'd') ||
195 (dateForm.at(begin + 1).latin1() == 'a') || 195 (dateForm.at(begin + 1).latin1() == 'a') ||
196 (dateForm.at(begin + 1).latin1() == 'A') ) ) { 196 (dateForm.at(begin + 1).latin1() == 'A') ) ) {
197 break; 197 break;
198 } 198 }
199 // mDateEdit-StringPos == CursorPosition(cpos) then break and set date 199 // mDateEdit-StringPos == CursorPosition(cpos) then break and set date
200 if( ( (space + allStrLength) <= *cpos && *cpos <= (space + allStrLength + strLength) ) || *cpos < begin ) { 200 if( ( (space + allStrLength) <= *cpos && *cpos <= (space + allStrLength + strLength) ) || *cpos < begin ) {
201 break; 201 break;
202 } 202 }
203 allStrLength += strLength; 203 allStrLength += strLength;
204 begin = dateForm.find("%", begin +1); 204 begin = dateForm.find("%", begin +1);
205 } 205 }
206 206
207 // set date 207 // set date
208 switch ( dateForm.at(begin + 1).latin1() ) { 208 switch ( dateForm.at(begin + 1).latin1() ) {
209 case 'd': 209 case 'd':
210 case 'a': 210 case 'a':
211 case 'A': 211 case 'A':
212 if(key == Key_Up) { 212 if(key == Key_Up) {
213 setDate( date.addDays( 1 ) ); 213 setDate( date.addDays( 1 ) );
214 } 214 }
215 else if(key == Key_Down) { 215 else if(key == Key_Down) {
216 setDate( date.addDays( -1 ) ); 216 setDate( date.addDays( -1 ) );
217 } 217 }
218 maxDay = readDate().day(); 218 maxDay = readDate().day();
219 break; 219 break;
220 case 'm': 220 case 'm':
221 case 'b': 221 case 'b':
222 case 'B': 222 case 'B':
223 if(key == Key_Up) { 223 if(key == Key_Up) {
224 int year = ((date.month()+1)>12)?date.year()+1:date.year(); 224 int year = ((date.month()+1)>12)?date.year()+1:date.year();
225 int month = ((date.month()+1)>12)?1:date.month()+1; 225 int month = ((date.month()+1)>12)?1:date.month()+1;
226 int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay; 226 int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay;
227 setDate( QDate( year, month, day ) ); 227 setDate( QDate( year, month, day ) );
228 } else if(key == Key_Down) { 228 } else if(key == Key_Down) {
229 int year = ((date.month()-1)<1)?date.year()-1:date.year(); 229 int year = ((date.month()-1)<1)?date.year()-1:date.year();
230 int month = ((date.month()-1)<1)?12:date.month()-1; 230 int month = ((date.month()-1)<1)?12:date.month()-1;
231 int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay; 231 int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay;
232 setDate( QDate( year, month, day ) ); 232 setDate( QDate( year, month, day ) );
233 } 233 }
234 break; 234 break;
235 case 'y': 235 case 'y':
236 case 'Y': 236 case 'Y':
237 if(key == Key_Up) { 237 if(key == Key_Up) {
238 setDate( QDate( date.year() + 1, date.month() , date.day()) ); 238 setDate( QDate( date.year() + 1, date.month() , date.day()) );
239 } 239 }
240 else if(key == Key_Down) { 240 else if(key == Key_Down) {
241 setDate( QDate( date.year() - 1, date.month() , date.day()) ); 241 setDate( QDate( date.year() - 1, date.month() , date.day()) );
242 } 242 }
243 break; 243 break;
244/* default: 244/* default:
245 if(key == Key_Up) { 245 if(key == Key_Up) {
246 setDate( date.addDays( 1 ) ); 246 setDate( date.addDays( 1 ) );
247 } else if(key == Key_Down) { 247 } else if(key == Key_Down) {
248 setDate( date.addDays( -1 ) ); 248 setDate( date.addDays( -1 ) );
249 } 249 }
250 break;*/ 250 break;*/
251 } 251 }
252 252
253 date = readDate(); 253 date = readDate();
254 begin = dateForm.find("%"); 254 begin = dateForm.find("%");
255 int allSelectStrLength = 0; 255 int allSelectStrLength = 0;
256 int selectStrLength = 0; 256 int selectStrLength = 0;
257 257
258 // set selection do new date an set cursor at end of selection 258 // set selection do new date an set cursor at end of selection
259 for(int i = 0; i < repeat; i++){ 259 for(int i = 0; i < repeat; i++){
260 switch ( dateForm.at(begin + 1).latin1() ) 260 switch ( dateForm.at(begin + 1).latin1() )
261 { 261 {
262 case 'd':// 16 (month day) 262 case 'd':// 16 (month day)
263 selectStrLength = 2; //Ok 263 selectStrLength = 2; //Ok
264 break; 264 break;
265 case 'm':// 01 (month) 265 case 'm':// 01 (month)
266 selectStrLength = 2; //Ok 266 selectStrLength = 2; //Ok
267 break; 267 break;
268 case 'a':// Mon (Weekday short) 268 case 'a':// Mon (Weekday short)
269 selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length(); 269 selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length();
270 break; 270 break;
271 case 'A':// Monday (Weekday) 271 case 'A':// Monday (Weekday)
272 selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length(); 272 selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length();
273 break; 273 break;
274 case 'b':// Jan (monthName short) 274 case 'b':// Jan (monthName short)
275 selectStrLength = KGlobal::locale()->monthName(date.month(), true).length(); 275 selectStrLength = KGlobal::locale()->monthName(date.month(), true).length();
276 break; 276 break;
277 case 'B':// January (monthName) 277 case 'B':// January (monthName)
278 selectStrLength = KGlobal::locale()->monthName(date.month(), false).length(); 278 selectStrLength = KGlobal::locale()->monthName(date.month(), false).length();
279 break; 279 break;
280 case 'y':// 04 (year short) 280 case 'y':// 04 (year short)
281 selectStrLength = 2; //Ok 281 selectStrLength = 2; //Ok
282 break; 282 break;
283 case 'Y':// 2004 (year) 283 case 'Y':// 2004 (year)
284 selectStrLength = 4; //Ok 284 selectStrLength = 4; //Ok
285 break; 285 break;
286 default: 286 default:
287 break; 287 break;
288 } 288 }
289 space = begin - (i * 2); 289 space = begin - (i * 2);
290 allSelectStrLength += selectStrLength; 290 allSelectStrLength += selectStrLength;
291 begin = dateForm.find("%", begin +1); 291 begin = dateForm.find("%", begin +1);
292 } 292 }
293 // set selection from begin of date 293 // set selection from begin of date
294 setSelect( space + allSelectStrLength - selectStrLength , selectStrLength); 294 setSelect( space + allSelectStrLength - selectStrLength , selectStrLength);
295 *cpos = space + allSelectStrLength; 295 *cpos = space + allSelectStrLength;
296 emit(dateChanged(date)); 296 emit(dateChanged(date));
297 297
298 return; 298 return;
299} 299}
300 300
301void KDateEdit::setHandleInvalid(bool handleInvalid) 301void KDateEdit::setHandleInvalid(bool handleInvalid)
302{ 302{
303 mHandleInvalid = handleInvalid; 303 mHandleInvalid = handleInvalid;
304} 304}
305 305
306void KDateEdit::setEnabled(bool on) 306void KDateEdit::setEnabled(bool on)
307{ 307{
308 mDateEdit->setEnabled(on); 308 mDateEdit->setEnabled(on);
309 mDateButton->setEnabled(on); 309 mDateButton->setEnabled(on);
310} 310}
311 311
312QDate KDateEdit::date() const 312QDate KDateEdit::date() const
313{ 313{
314 QDate date = readDate(); 314 QDate date = readDate();
315 315
316 if (date.isValid() || mHandleInvalid) { 316 if (date.isValid() || mHandleInvalid) {
317 return date; 317 return date;
318 } else { 318 } else {
319 KNotifyClient::beep(); 319 KNotifyClient::beep();
320 return QDate::currentDate(); 320 return QDate::currentDate();
321 } 321 }
322} 322}
323 323
324void KDateEdit::keyPressEvent(QKeyEvent *e) 324void KDateEdit::keyPressEvent(QKeyEvent *e)
325{ 325{
326 QDate date = readDate(); 326 QDate date = readDate();
327 int cpos = mDateEdit->cursorPosition(); 327 int cpos = mDateEdit->cursorPosition();
328 328
329 switch(e->key()) 329 switch(e->key())
330 { 330 {
331 case Key_Escape: 331 case Key_Escape:
332 mDateEdit->deselect(); 332 mDateEdit->deselect();
333 case Key_Tab: 333 case Key_Tab:
334 QHBox::keyPressEvent(e); 334 QHBox::keyPressEvent(e);
335 break; 335 break;
336 case Key_Up: 336 case Key_Up:
337 // when date invalid then set to currend and return 337 // when date invalid then set to currend and return
338 if(!date.isValid()) { 338 if(!date.isValid()) {
339 date = QDate::currentDate(); 339 date = QDate::currentDate();
340 setDate(date); 340 setDate(date);
341 mDateEdit->setCursorPosition(cpos); 341 mDateEdit->setCursorPosition(cpos);
342 emit(dateChanged(date)); 342 emit(dateChanged(date));
343 QString text = i18n( "You entered an invalid date!\n Date changed to current date." ); 343 QString text = i18n( "You entered an invalid date!\n Date changed to current date." );
344 KMessageBox::information( 0, text ); 344 KMessageBox::information( 0, text );
345 return; 345 return;
346 } 346 }
347 setDate(date, &cpos, Key_Up, dateFormShort); 347 setDate(date, &cpos, Key_Up, dateFormShort);
348 break; 348 break;
349 case Key_Down: 349 case Key_Down:
350 // when date invalid then set to current and return 350 // when date invalid then set to current and return
351 if(!date.isValid()) { 351 if(!date.isValid()) {
352 date = QDate::currentDate(); 352 date = QDate::currentDate();
353 setDate(date); 353 setDate(date);
354 mDateEdit->setCursorPosition(cpos); 354 mDateEdit->setCursorPosition(cpos);
355 emit(dateChanged(date)); 355 emit(dateChanged(date));
356 QString text = i18n( "You entered an invalid date!\n Date changed to current date." ); 356 QString text = i18n( "You entered an invalid date!\n Date changed to current date." );
357 KMessageBox::information( 0, text ); 357 KMessageBox::information( 0, text );
358 return; 358 return;
359 } 359 }
360 setDate(date, &cpos, Key_Down, dateFormShort); 360 setDate(date, &cpos, Key_Down, dateFormShort);
361 break; 361 break;
362 default: 362 default:
363 QHBox::keyPressEvent(e); 363 QHBox::keyPressEvent(e);
364 break; 364 break;
365 } // switch 365 } // switch
366 mDateEdit->setCursorPosition(cpos); 366 mDateEdit->setCursorPosition(cpos);
367} 367}
368 368
369void KDateEdit::setSelect( int from, int to ) 369void KDateEdit::setSelect( int from, int to )
370{ 370{
371// return; 371// return;
372 mDateEdit->setSelection( from , to ); 372 mDateEdit->setSelection( from , to );
373} 373}
374 374
375void KDateEdit::toggleDatePicker() 375void KDateEdit::toggleDatePicker()
376{ 376{
377 if( mDateFrame->isVisible() ) { 377 if( mDateFrame->isVisible() ) {
378 mDateFrame->hide(); 378 mDateFrame->hide();
379 } else { 379 } else {
380 QPoint tmpPoint = mapToGlobal(mDateButton->geometry().bottomRight()); 380 QPoint tmpPoint = mapToGlobal(mDateButton->geometry().bottomRight());
381 QSize datepickersize = mDatePicker->sizeHint(); 381 QSize datepickersize = mDatePicker->sizeHint();
382 382
383 if ( tmpPoint.x() < 7+datepickersize.width() ) tmpPoint.setX( 7+datepickersize.width() ); 383 if ( tmpPoint.x() < 7+datepickersize.width() ) tmpPoint.setX( 7+datepickersize.width() );
384 384
385 int h = QApplication::desktop()->height(); 385 int h = QApplication::desktop()->height();
386 386
387 if ( tmpPoint.y() + datepickersize.height() > h ) tmpPoint.setY( h - datepickersize.height() ); 387 if ( tmpPoint.y() + datepickersize.height() > h ) tmpPoint.setY( h - datepickersize.height() );
388 388
389 mDateFrame->setGeometry(tmpPoint.x()-datepickersize.width()-7, tmpPoint.y(), 389 mDateFrame->setGeometry(tmpPoint.x()-datepickersize.width()-7, tmpPoint.y(),
390 datepickersize.width()+2*mDateFrame->lineWidth(), datepickersize.height()+2*mDateFrame->lineWidth()); 390 datepickersize.width()+2*mDateFrame->lineWidth(), datepickersize.height()+2*mDateFrame->lineWidth());
391 391
392 QDate date = readDate(); 392 QDate date = readDate();
393 if(date.isValid()) { 393 if(date.isValid()) {
394 mDatePicker->setDate(date); 394 mDatePicker->setDate(date);
395 } else { 395 } else {
396 mDatePicker->setDate(QDate::currentDate()); 396 mDatePicker->setDate(QDate::currentDate());
397 } 397 }
398 mDateFrame->show(); 398 mDateFrame->show();
399 } 399 }
400} 400}
401 401
402 402
403void KDateEdit::lineEnterPressed() 403void KDateEdit::lineEnterPressed()
404{ 404{
405 QDate date = readDate(); 405 QDate date = readDate();
406 406
407 if(date.isValid()) 407 if(date.isValid())
408 { 408 {
409 // Update the edit. This is needed if the user has entered a 409 // Update the edit. This is needed if the user has entered a
410 // word rather than the actual date. 410 // word rather than the actual date.
411 setDate(date); 411 setDate(date);
412 emit(dateChanged(date)); 412 emit(dateChanged(date));
413 emit returnPressed(); 413 emit returnPressed();
414 } 414 }
415 else 415 else
416 { 416 {
417 if ( withoutDp ) { 417 if ( withoutDp ) {
418 KNotifyClient::beep(); 418 KNotifyClient::beep();
419 } else { 419 } else {
420 if ( !mDateEdit->text().isEmpty() ) { 420 if ( !mDateEdit->text().isEmpty() ) {
421 mTextChanged = false; 421 mTextChanged = false;
422 QString text = i18n( "You entered an invalid date!\n Will use current date instead." ); 422 QString text = i18n( "You entered an invalid date!\n Will use current date instead." );
423 if ( KMessageBox::warningContinueCancel( 0, text ) == KMessageBox::Continue ) { 423 if ( KMessageBox::warningContinueCancel( 0, text ) == KMessageBox::Continue ) {
424 setDate( QDate::currentDate() ); 424 setDate( QDate::currentDate() );
425 emit dateChanged( QDate::currentDate() ); 425 emit dateChanged( QDate::currentDate() );
diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp
index 6e5ec0f..3fe139c 100644
--- a/libkdepim/kdatepicker.cpp
+++ b/libkdepim/kdatepicker.cpp
@@ -1,422 +1,422 @@
1/* -*- C++ -*- 1/* -*- C++ -*-
2 This file is part of the KDE libraries 2 This file is part of the KDE libraries
3 Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org) 3 Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
4 (C) 1998-2001 Mirko Boehm (mirko@kde.org) 4 (C) 1998-2001 Mirko Boehm (mirko@kde.org)
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include "kdatepicker.h" 21#include "kdatepicker.h"
22#include <kglobal.h> 22#include <kglobal.h>
23#include <kapplication.h> 23#include <kapplication.h>
24#include <klocale.h> 24#include <klocale.h>
25#include <kiconloader.h> 25#include <kiconloader.h>
26#include <qframe.h> 26#include <qframe.h>
27#include <qpainter.h> 27#include <qpainter.h>
28#include <qdialog.h> 28#include <qdialog.h>
29#include <qtoolbutton.h> 29#include <qtoolbutton.h>
30#include <qfont.h> 30#include <qfont.h>
31#include <qapplication.h> 31#include <qapplication.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qvalidator.h> 33#include <qvalidator.h>
34#include <kdebug.h> 34#include <kdebug.h>
35#include <knotifyclient.h> 35#include <knotifyclient.h>
36#include "kdatetbl.h" 36#include "kdatetbl.h"
37#include "kdateedit.h" 37#include "kdateedit.h"
38#include "kdatepicker.moc" 38//#include "kdatepicker.moc"
39 39
40 40
41KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) 41KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name)
42 : QFrame(parent,name), 42 : QFrame(parent,name),
43 yearForward(new QToolButton(this)), 43 yearForward(new QToolButton(this)),
44 yearBackward(new QToolButton(this)), 44 yearBackward(new QToolButton(this)),
45 monthForward(new QToolButton(this)), 45 monthForward(new QToolButton(this)),
46 monthBackward(new QToolButton(this)), 46 monthBackward(new QToolButton(this)),
47 selectMonth(new QToolButton(this)), 47 selectMonth(new QToolButton(this)),
48 selectYear(new QToolButton(this)), 48 selectYear(new QToolButton(this)),
49 //line(new QLineEdit(this)), 49 //line(new QLineEdit(this)),
50 val(new KDateValidator(this)) 50 val(new KDateValidator(this))
51 //table(new KDateTable(this)), 51 //table(new KDateTable(this)),
52 //fontsize(1) 52 //fontsize(1)
53{ 53{
54 // ----- 54 // -----
55 int size = 12; 55 int size = 12;
56 if ( QApplication::desktop()->width() >= 480 ) 56 if ( QApplication::desktop()->width() >= 480 )
57 size = 18; 57 size = 18;
58 fontsize = size; 58 fontsize = size;
59 setFont ( QFont("helvetica",size) ); 59 setFont ( QFont("helvetica",size) );
60 table = new KDateTable(this); 60 table = new KDateTable(this);
61 setFontSize(size); 61 setFontSize(size);
62 //line->setValidator(val); 62 //line->setValidator(val);
63 lineDate = new KDateEdit( this, "dateediipicker", true ); 63 lineDate = new KDateEdit( this, "dateediipicker", true );
64 yearForward->setPixmap(SmallIcon("2rightarrowB")); 64 yearForward->setPixmap(SmallIcon("2rightarrowB"));
65 yearBackward->setPixmap(SmallIcon("2leftarrowB")); 65 yearBackward->setPixmap(SmallIcon("2leftarrowB"));
66 monthForward->setPixmap(SmallIcon("1rightarrowB")); 66 monthForward->setPixmap(SmallIcon("1rightarrowB"));
67 monthBackward->setPixmap(SmallIcon("1leftarrowB")); 67 monthBackward->setPixmap(SmallIcon("1leftarrowB"));
68 68
69 setDate(dt); // set button texts 69 setDate(dt); // set button texts
70 connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate))); 70 connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate)));
71 connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot())); 71 connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot()));
72 connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked())); 72 connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked()));
73 connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked())); 73 connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked()));
74 connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked())); 74 connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked()));
75 connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked())); 75 connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked()));
76 connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); 76 connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked()));
77 connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); 77 connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked()));
78 //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); 78 //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed()));
79 connect(lineDate, SIGNAL(dateChanged(QDate)), SLOT(slotSetDate(QDate))); 79 connect(lineDate, SIGNAL(dateChanged(QDate)), SLOT(slotSetDate(QDate)));
80 connect(lineDate, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); 80 connect(lineDate, SIGNAL(returnPressed()), SLOT(lineEnterPressed()));
81 table->setFocus(); 81 table->setFocus();
82 82
83} 83}
84 84
85KDatePicker::~KDatePicker() 85KDatePicker::~KDatePicker()
86{ 86{
87} 87}
88 88
89void 89void
90KDatePicker::resizeEvent(QResizeEvent*) 90KDatePicker::resizeEvent(QResizeEvent*)
91{ 91{
92 QWidget *buttons[] = { 92 QWidget *buttons[] = {
93 yearBackward, 93 yearBackward,
94 monthBackward, 94 monthBackward,
95 selectMonth, 95 selectMonth,
96 selectYear, 96 selectYear,
97 monthForward, 97 monthForward,
98 yearForward }; 98 yearForward };
99 const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); 99 const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]);
100 QSize sizes[NoOfButtons]; 100 QSize sizes[NoOfButtons];
101 int buttonHeight=0; 101 int buttonHeight=0;
102 int count; 102 int count;
103 int w; 103 int w;
104 int x=0; 104 int x=0;
105 // ----- calculate button row height: 105 // ----- calculate button row height:
106 for(count=0; count<NoOfButtons; ++count) { 106 for(count=0; count<NoOfButtons; ++count) {
107 int xS = buttons[count]->sizeHint().width(); 107 int xS = buttons[count]->sizeHint().width();
108 int yS = buttons[count]->sizeHint().height(); 108 int yS = buttons[count]->sizeHint().height();
109 sizes[count]=QSize ( xS+10, yS ); 109 sizes[count]=QSize ( xS+10, yS );
110 buttonHeight=QMAX(buttonHeight, sizes[count].height()); 110 buttonHeight=QMAX(buttonHeight, sizes[count].height());
111 } 111 }
112 buttonHeight += 10; 112 buttonHeight += 10;
113 // ----- calculate size of the month button: 113 // ----- calculate size of the month button:
114 w=0; 114 w=0;
115 for(count=0; count<NoOfButtons; ++count) { 115 for(count=0; count<NoOfButtons; ++count) {
116 if(buttons[count]!=selectMonth) 116 if(buttons[count]!=selectMonth)
117 { 117 {
118 w+=sizes[count].width(); 118 w+=sizes[count].width();
119 } else { 119 } else {
120 x=count; 120 x=count;
121 } 121 }
122 } 122 }
123 sizes[x].setWidth(width()-w); // stretch the month button 123 sizes[x].setWidth(width()-w); // stretch the month button
124 // ----- place the buttons: 124 // ----- place the buttons:
125 x=0; 125 x=0;
126 for(count=0; count<NoOfButtons; ++count) 126 for(count=0; count<NoOfButtons; ++count)
127 { 127 {
128 w=sizes[count].width(); 128 w=sizes[count].width();
129 buttons[count]->setGeometry(x, 0, w, buttonHeight); 129 buttons[count]->setGeometry(x, 0, w, buttonHeight);
130 x+=w; 130 x+=w;
131 } 131 }
132 // ----- place the line edit for direct input: 132 // ----- place the line edit for direct input:
133 sizes[0]=lineDate->sizeHint(); 133 sizes[0]=lineDate->sizeHint();
134 //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); 134 //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height());
135 lineDate->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); 135 lineDate->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height());
136 // ----- adjust the table: 136 // ----- adjust the table:
137 table->setGeometry(0, buttonHeight, width(), 137 table->setGeometry(0, buttonHeight, width(),
138 height()-buttonHeight-sizes[0].height()); 138 height()-buttonHeight-sizes[0].height());
139} 139}
140 140
141void 141void
142KDatePicker::dateChangedSlot(QDate date) 142KDatePicker::dateChangedSlot(QDate date)
143{ 143{
144 lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true)); 144 lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true));
145 //line->setText(KGlobal::locale()->formatDate(date, true)); 145 //line->setText(KGlobal::locale()->formatDate(date, true));
146 emit(dateChanged(date)); 146 emit(dateChanged(date));
147} 147}
148 148
149void 149void
150KDatePicker::tableClickedSlot() 150KDatePicker::tableClickedSlot()
151{ 151{
152 152
153 emit(dateSelected(table->getDate())); 153 emit(dateSelected(table->getDate()));
154 emit(tableClicked()); 154 emit(tableClicked());
155} 155}
156 156
157const QDate& 157const QDate&
158KDatePicker::getDate() const 158KDatePicker::getDate() const
159{ 159{
160 return table->getDate(); 160 return table->getDate();
161} 161}
162 162
163const QDate & 163const QDate &
164KDatePicker::date() const 164KDatePicker::date() const
165{ 165{
166 return table->getDate(); 166 return table->getDate();
167} 167}
168 168
169void KDatePicker::slotSetDate( QDate date ) 169void KDatePicker::slotSetDate( QDate date )
170{ 170{
171 171
172 if(date.isValid()) { 172 if(date.isValid()) {
173 QString temp; 173 QString temp;
174 // ----- 174 // -----
175 table->setDate(date); 175 table->setDate(date);
176 selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); 176 selectMonth->setText(KGlobal::locale()->monthName(date.month(), false));
177 temp.setNum(date.year()); 177 temp.setNum(date.year());
178 selectYear->setText(temp); 178 selectYear->setText(temp);
179 //line->setText(KGlobal::locale()->formatDate(date, true)); 179 //line->setText(KGlobal::locale()->formatDate(date, true));
180 lineDate->setDate( date ); 180 lineDate->setDate( date );
181 } 181 }
182 182
183} 183}
184bool 184bool
185KDatePicker::setDate(const QDate& date) 185KDatePicker::setDate(const QDate& date)
186{ 186{
187 table->setFocus(); 187 table->setFocus();
188 if(date.isValid()) { 188 if(date.isValid()) {
189 QString temp; 189 QString temp;
190 // ----- 190 // -----
191 table->setDate(date); 191 table->setDate(date);
192 selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); 192 selectMonth->setText(KGlobal::locale()->monthName(date.month(), false));
193 temp.setNum(date.year()); 193 temp.setNum(date.year());
194 selectYear->setText(temp); 194 selectYear->setText(temp);
195 //line->setText(KGlobal::locale()->formatDate(date, true)); 195 //line->setText(KGlobal::locale()->formatDate(date, true));
196 lineDate->setDate( date ); 196 lineDate->setDate( date );
197 return true; 197 return true;
198 } else { 198 } else {
199 199
200 return false; 200 return false;
201 } 201 }
202 202
203 203
204} 204}
205 205
206void 206void
207KDatePicker::monthForwardClicked() 207KDatePicker::monthForwardClicked()
208{ 208{
209 QDate temp=table->getDate(); 209 QDate temp=table->getDate();
210 int day=temp.day(); 210 int day=temp.day();
211 // ----- 211 // -----
212 if(temp.month()==12) { 212 if(temp.month()==12) {
213 temp.setYMD(temp.year()+1, 1, 1); 213 temp.setYMD(temp.year()+1, 1, 1);
214 } else { 214 } else {
215 temp.setYMD(temp.year(), temp.month()+1, 1); 215 temp.setYMD(temp.year(), temp.month()+1, 1);
216 } 216 }
217 if(temp.daysInMonth()<day) { 217 if(temp.daysInMonth()<day) {
218 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); 218 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth());
219 } else { 219 } else {
220 temp.setYMD(temp.year(), temp.month(), day); 220 temp.setYMD(temp.year(), temp.month(), day);
221 } 221 }
222 // assert(temp.isValid()); 222 // assert(temp.isValid());
223 setDate(temp); 223 setDate(temp);
224} 224}
225 225
226void 226void
227KDatePicker::monthBackwardClicked() 227KDatePicker::monthBackwardClicked()
228{ 228{
229 QDate temp=table->getDate(); 229 QDate temp=table->getDate();
230 int day=temp.day(); 230 int day=temp.day();
231 // ----- 231 // -----
232 if(temp.month()==1) 232 if(temp.month()==1)
233 { 233 {
234 temp.setYMD(temp.year()-1, 12, 1); 234 temp.setYMD(temp.year()-1, 12, 1);
235 } else { 235 } else {
236 temp.setYMD(temp.year(), temp.month()-1, 1); 236 temp.setYMD(temp.year(), temp.month()-1, 1);
237 } 237 }
238 if(temp.daysInMonth()<day) 238 if(temp.daysInMonth()<day)
239 { 239 {
240 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); 240 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth());
241 } else { 241 } else {
242 temp.setYMD(temp.year(), temp.month(), day); 242 temp.setYMD(temp.year(), temp.month(), day);
243 } 243 }
244 // assert(temp.isValid()); 244 // assert(temp.isValid());
245 setDate(temp); 245 setDate(temp);
246} 246}
247 247
248void 248void
249KDatePicker::yearForwardClicked() 249KDatePicker::yearForwardClicked()
250{ 250{
251 QDate temp=table->getDate(); 251 QDate temp=table->getDate();
252 int day=temp.day(); 252 int day=temp.day();
253 // ----- 253 // -----
254 temp.setYMD(temp.year()+1, temp.month(), 1); 254 temp.setYMD(temp.year()+1, temp.month(), 1);
255 if(temp.daysInMonth()<day) 255 if(temp.daysInMonth()<day)
256 { 256 {
257 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); 257 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth());
258 } else { 258 } else {
259 temp.setYMD(temp.year(), temp.month(), day); 259 temp.setYMD(temp.year(), temp.month(), day);
260 } 260 }
261 // assert(temp.isValid()); 261 // assert(temp.isValid());
262 setDate(temp); 262 setDate(temp);
263} 263}
264 264
265void 265void
266KDatePicker::yearBackwardClicked() 266KDatePicker::yearBackwardClicked()
267{ 267{
268 QDate temp=table->getDate(); 268 QDate temp=table->getDate();
269 int day=temp.day(); 269 int day=temp.day();
270 // ----- 270 // -----
271 temp.setYMD(temp.year()-1, temp.month(), 1); 271 temp.setYMD(temp.year()-1, temp.month(), 1);
272 if(temp.daysInMonth()<day) 272 if(temp.daysInMonth()<day)
273 { 273 {
274 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); 274 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth());
275 } else { 275 } else {
276 temp.setYMD(temp.year(), temp.month(), day); 276 temp.setYMD(temp.year(), temp.month(), day);
277 } 277 }
278 // assert(temp.isValid()); 278 // assert(temp.isValid());
279 setDate(temp); 279 setDate(temp);
280} 280}
281 281
282void 282void
283KDatePicker::selectMonthClicked() 283KDatePicker::selectMonthClicked()
284{ 284{
285 int month; 285 int month;
286 KPopupFrame* popup = new KPopupFrame(this); 286 KPopupFrame* popup = new KPopupFrame(this);
287 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(fontsize, popup); 287 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(fontsize, popup);
288 // ----- 288 // -----
289 picker->resize(picker->sizeHint()); 289 picker->resize(picker->sizeHint());
290 popup->setMainWidget(picker); 290 popup->setMainWidget(picker);
291 picker->setFocus(); 291 picker->setFocus();
292 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 292 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
293 if(popup->exec(selectMonth->mapToGlobal(QPoint(0, selectMonth->height())))) 293 if(popup->exec(selectMonth->mapToGlobal(QPoint(0, selectMonth->height()))))
294 { 294 {
295 QDate date; 295 QDate date;
296 int day; 296 int day;
297 // ----- 297 // -----
298 month=picker->getResult(); 298 month=picker->getResult();
299 date=table->getDate(); 299 date=table->getDate();
300 day=date.day(); 300 day=date.day();
301 // ----- construct a valid date in this month: 301 // ----- construct a valid date in this month:
302 date.setYMD(date.year(), month, 1); 302 date.setYMD(date.year(), month, 1);
303 date.setYMD(date.year(), month, QMIN(day, date.daysInMonth())); 303 date.setYMD(date.year(), month, QMIN(day, date.daysInMonth()));
304 // ----- set this month 304 // ----- set this month
305 setDate(date); 305 setDate(date);
306 } else { 306 } else {
307 KNotifyClient::beep(); 307 KNotifyClient::beep();
308 } 308 }
309 delete popup; 309 delete popup;
310} 310}
311 311
312void 312void
313KDatePicker::selectYearClicked() 313KDatePicker::selectYearClicked()
314{ 314{
315 int year; 315 int year;
316 KPopupFrame* popup = new KPopupFrame(this); 316 KPopupFrame* popup = new KPopupFrame(this);
317 KDateInternalYearSelector* picker = new KDateInternalYearSelector(fontsize, popup); 317 KDateInternalYearSelector* picker = new KDateInternalYearSelector(fontsize, popup);
318 // ----- 318 // -----
319 picker->resize(picker->sizeHint()); 319 picker->resize(picker->sizeHint());
320 popup->setMainWidget(picker); 320 popup->setMainWidget(picker);
321 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 321 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
322 picker->setFocus(); 322 picker->setFocus();
323 if(popup->exec(selectYear->mapToGlobal(QPoint(0, selectMonth->height())))) 323 if(popup->exec(selectYear->mapToGlobal(QPoint(0, selectMonth->height()))))
324 { 324 {
325 QDate date; 325 QDate date;
326 int day; 326 int day;
327 // ----- 327 // -----
328 year=picker->getYear(); 328 year=picker->getYear();
329 date=table->getDate(); 329 date=table->getDate();
330 day=date.day(); 330 day=date.day();
331 // ----- construct a valid date in this month: 331 // ----- construct a valid date in this month:
332 date.setYMD(year, date.month(), 1); 332 date.setYMD(year, date.month(), 1);
333 date.setYMD(year, date.month(), QMIN(day, date.daysInMonth())); 333 date.setYMD(year, date.month(), QMIN(day, date.daysInMonth()));
334 // ----- set this month 334 // ----- set this month
335 setDate(date); 335 setDate(date);
336 } else { 336 } else {
337 KNotifyClient::beep(); 337 KNotifyClient::beep();
338 } 338 }
339 delete popup; 339 delete popup;
340} 340}
341 341
342void 342void
343KDatePicker::setEnabled(bool enable) 343KDatePicker::setEnabled(bool enable)
344{ 344{
345 QWidget *widgets[]= { 345 QWidget *widgets[]= {
346 yearForward, yearBackward, monthForward, monthBackward, 346 yearForward, yearBackward, monthForward, monthBackward,
347 selectMonth, selectYear, 347 selectMonth, selectYear,
348 lineDate, table }; 348 lineDate, table };
349 const int Size=sizeof(widgets)/sizeof(widgets[0]); 349 const int Size=sizeof(widgets)/sizeof(widgets[0]);
350 int count; 350 int count;
351 // ----- 351 // -----
352 for(count=0; count<Size; ++count) 352 for(count=0; count<Size; ++count)
353 { 353 {
354 widgets[count]->setEnabled(enable); 354 widgets[count]->setEnabled(enable);
355 } 355 }
356} 356}
357 357
358void 358void
359KDatePicker::lineEnterPressed() 359KDatePicker::lineEnterPressed()
360{ 360{
361 QDate temp; 361 QDate temp;
362 // ----- 362 // -----
363 temp = lineDate->date(); 363 temp = lineDate->date();
364 //if(val->date(line->text(), temp)==QValidator::Acceptable) 364 //if(val->date(line->text(), temp)==QValidator::Acceptable)
365 //{ 365 //{
366 emit(dateEntered(temp)); 366 emit(dateEntered(temp));
367 setDate(temp); 367 setDate(temp);
368 // } else { 368 // } else {
369// KNotifyClient::beep(); 369// KNotifyClient::beep();
370// } 370// }
371} 371}
372 372
373QSize 373QSize
374KDatePicker::sizeHint() const 374KDatePicker::sizeHint() const
375{ 375{
376 QSize tableSize=table->sizeHint(); 376 QSize tableSize=table->sizeHint();
377 QWidget *buttons[]={ 377 QWidget *buttons[]={
378 yearBackward, 378 yearBackward,
379 monthBackward, 379 monthBackward,
380 selectMonth, 380 selectMonth,
381 selectYear, 381 selectYear,
382 monthForward, 382 monthForward,
383 yearForward }; 383 yearForward };
384 const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); 384 const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]);
385 QSize sizes[NoOfButtons]; 385 QSize sizes[NoOfButtons];
386 int cx=0, cy=0, count; 386 int cx=0, cy=0, count;
387 // ----- store the size hints: 387 // ----- store the size hints:
388 for(count=0; count<NoOfButtons; ++count) 388 for(count=0; count<NoOfButtons; ++count)
389 { 389 {
390 sizes[count]=buttons[count]->sizeHint(); 390 sizes[count]=buttons[count]->sizeHint();
391 if(buttons[count]==selectMonth) 391 if(buttons[count]==selectMonth)
392 { 392 {
393 cx+=maxMonthRect.width()+15; 393 cx+=maxMonthRect.width()+15;
394 } else { 394 } else {
395 cx+=sizes[count].width()+15; 395 cx+=sizes[count].width()+15;
396 } 396 }
397 cy=QMAX(sizes[count].height(), cy); 397 cy=QMAX(sizes[count].height(), cy);
398 } 398 }
399 // ----- calculate width hint: 399 // ----- calculate width hint:
400 cx=QMAX(cx, tableSize.width()); // line edit ignored 400 cx=QMAX(cx, tableSize.width()); // line edit ignored
401 if ( cx > QApplication::desktop()->width() -5 ) 401 if ( cx > QApplication::desktop()->width() -5 )
402 cx = QApplication::desktop()->width() -5; 402 cx = QApplication::desktop()->width() -5;
403 // ----- calculate height hint: 403 // ----- calculate height hint:
404 cy+=tableSize.height()+lineDate->sizeHint().height(); 404 cy+=tableSize.height()+lineDate->sizeHint().height();
405 405
406 return QSize(cx, cy); 406 return QSize(cx, cy);
407} 407}
408 408
409void 409void
410KDatePicker::setFontSize(int s) 410KDatePicker::setFontSize(int s)
411{ 411{
412 QWidget *buttons[]= { 412 QWidget *buttons[]= {
413 // yearBackward, 413 // yearBackward,
414 // monthBackward, 414 // monthBackward,
415 selectMonth, 415 selectMonth,
416 selectYear, 416 selectYear,
417 // monthForward, 417 // monthForward,
418 // yearForward 418 // yearForward
419 }; 419 };
420 const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); 420 const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]);
421 int count; 421 int count;
422 QFont font; 422 QFont font;
diff --git a/libkdepim/kprefsdialog.cpp b/libkdepim/kprefsdialog.cpp
index 3a39ea9..205c526 100644
--- a/libkdepim/kprefsdialog.cpp
+++ b/libkdepim/kprefsdialog.cpp
@@ -1,410 +1,410 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24// $Id$ 24// $Id$
25 25
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qgroupbox.h> 28#include <qgroupbox.h>
29#include <qbuttongroup.h> 29#include <qbuttongroup.h>
30#include <qlineedit.h> 30#include <qlineedit.h>
31#include <qfont.h> 31#include <qfont.h>
32#include <qslider.h> 32#include <qslider.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qtextstream.h> 34#include <qtextstream.h>
35#include <qvbox.h> 35#include <qvbox.h>
36#include <qhbox.h> 36#include <qhbox.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qframe.h> 39#include <qframe.h>
40#include <qcombobox.h> 40#include <qcombobox.h>
41#include <qcheckbox.h> 41#include <qcheckbox.h>
42#include <qradiobutton.h> 42#include <qradiobutton.h>
43#include <qpushbutton.h> 43#include <qpushbutton.h>
44#include <qapplication.h> 44#include <qapplication.h>
45 45
46#include <kcolorbutton.h> 46#include <kcolorbutton.h>
47#include <kdebug.h> 47#include <kdebug.h>
48#include <klocale.h> 48#include <klocale.h>
49#include <kglobal.h> 49#include <kglobal.h>
50#include <kfontdialog.h> 50#include <kfontdialog.h>
51#include <kmessagebox.h> 51#include <kmessagebox.h>
52#include <kcolordialog.h> 52#include <kcolordialog.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54 54
55#include "kprefs.h" 55#include "kprefs.h"
56 56
57#include "kprefsdialog.h" 57#include "kprefsdialog.h"
58#include "kprefsdialog.moc" 58//#include "kprefsdialog.moc"
59 59
60KPrefsWidBool::KPrefsWidBool(const QString &text,bool *reference, 60KPrefsWidBool::KPrefsWidBool(const QString &text,bool *reference,
61 QWidget *parent) 61 QWidget *parent)
62{ 62{
63 mReference = reference; 63 mReference = reference;
64 64
65 mCheck = new QCheckBox(text,parent); 65 mCheck = new QCheckBox(text,parent);
66} 66}
67 67
68void KPrefsWidBool::readConfig() 68void KPrefsWidBool::readConfig()
69{ 69{
70 mCheck->setChecked(*mReference); 70 mCheck->setChecked(*mReference);
71} 71}
72 72
73void KPrefsWidBool::writeConfig() 73void KPrefsWidBool::writeConfig()
74{ 74{
75 *mReference = mCheck->isChecked(); 75 *mReference = mCheck->isChecked();
76} 76}
77 77
78QCheckBox *KPrefsWidBool::checkBox() 78QCheckBox *KPrefsWidBool::checkBox()
79{ 79{
80 return mCheck; 80 return mCheck;
81} 81}
82 82
83 83
84KPrefsWidColor::KPrefsWidColor(const QString &text,QColor *reference, 84KPrefsWidColor::KPrefsWidColor(const QString &text,QColor *reference,
85 QWidget *parent) 85 QWidget *parent)
86{ 86{
87 mReference = reference; 87 mReference = reference;
88 88
89 mButton = new KColorButton(parent); 89 mButton = new KColorButton(parent);
90 mLabel = new QLabel(mButton, text, parent); 90 mLabel = new QLabel(mButton, text, parent);
91 mButton->setColor( *mReference ); 91 mButton->setColor( *mReference );
92 mButton->setColor( Qt::red ); 92 mButton->setColor( Qt::red );
93 93
94} 94}
95 95
96KPrefsWidColor::~KPrefsWidColor() 96KPrefsWidColor::~KPrefsWidColor()
97{ 97{
98// kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl; 98// kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl;
99} 99}
100 100
101void KPrefsWidColor::readConfig() 101void KPrefsWidColor::readConfig()
102{ 102{
103 mButton->setColor(*mReference); 103 mButton->setColor(*mReference);
104} 104}
105 105
106void KPrefsWidColor::writeConfig() 106void KPrefsWidColor::writeConfig()
107{ 107{
108 *mReference = mButton->color(); 108 *mReference = mButton->color();
109} 109}
110 110
111QLabel *KPrefsWidColor::label() 111QLabel *KPrefsWidColor::label()
112{ 112{
113 return mLabel; 113 return mLabel;
114} 114}
115 115
116KColorButton *KPrefsWidColor::button() 116KColorButton *KPrefsWidColor::button()
117{ 117{
118 return mButton; 118 return mButton;
119} 119}
120 120
121KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText, 121KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText,
122 QFont *reference,QWidget *parent) 122 QFont *reference,QWidget *parent)
123{ 123{
124 mReference = reference; 124 mReference = reference;
125 125
126 mLabel = new QLabel(labelText, parent); 126 mLabel = new QLabel(labelText, parent);
127 127
128 mPreview = new QLabel(sampleText,parent); 128 mPreview = new QLabel(sampleText,parent);
129 mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); 129 mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken);
130 130
131 mButton = new QPushButton(i18n("Choose..."), parent); 131 mButton = new QPushButton(i18n("Choose..."), parent);
132 connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); 132 connect(mButton,SIGNAL(clicked()),SLOT(selectFont()));
133 mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); 133 mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 );
134 mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); 134 mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 );
135} 135}
136 136
137KPrefsWidFont::~KPrefsWidFont() 137KPrefsWidFont::~KPrefsWidFont()
138{ 138{
139} 139}
140 140
141void KPrefsWidFont::readConfig() 141void KPrefsWidFont::readConfig()
142{ 142{
143 mPreview->setFont(*mReference); 143 mPreview->setFont(*mReference);
144} 144}
145 145
146void KPrefsWidFont::writeConfig() 146void KPrefsWidFont::writeConfig()
147{ 147{
148 *mReference = mPreview->font(); 148 *mReference = mPreview->font();
149} 149}
150 150
151QLabel *KPrefsWidFont::label() 151QLabel *KPrefsWidFont::label()
152{ 152{
153 return mLabel; 153 return mLabel;
154} 154}
155 155
156QLabel *KPrefsWidFont::preview() 156QLabel *KPrefsWidFont::preview()
157{ 157{
158 return mPreview; 158 return mPreview;
159} 159}
160 160
161QPushButton *KPrefsWidFont::button() 161QPushButton *KPrefsWidFont::button()
162{ 162{
163 return mButton; 163 return mButton;
164} 164}
165 165
166void KPrefsWidFont::selectFont() 166void KPrefsWidFont::selectFont()
167{ 167{
168 QFont myFont(mPreview->font()); 168 QFont myFont(mPreview->font());
169 bool ok; 169 bool ok;
170 myFont = KFontDialog::getFont(myFont, ok); 170 myFont = KFontDialog::getFont(myFont, ok);
171 if ( ok ) { 171 if ( ok ) {
172 mPreview->setFont(myFont); 172 mPreview->setFont(myFont);
173 } 173 }
174} 174}
175 175
176 176
177KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference, 177KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference,
178 QWidget *parent) 178 QWidget *parent)
179{ 179{
180 mReference = reference; 180 mReference = reference;
181 181
182 mLabel = new QLabel(text,parent); 182 mLabel = new QLabel(text,parent);
183 mSpin = new QSpinBox(0,23,1,parent); 183 mSpin = new QSpinBox(0,23,1,parent);
184 mSpin->setSuffix(":00"); 184 mSpin->setSuffix(":00");
185} 185}
186 186
187void KPrefsWidTime::readConfig() 187void KPrefsWidTime::readConfig()
188{ 188{
189 mSpin->setValue(*mReference); 189 mSpin->setValue(*mReference);
190} 190}
191 191
192void KPrefsWidTime::writeConfig() 192void KPrefsWidTime::writeConfig()
193{ 193{
194 *mReference = mSpin->value(); 194 *mReference = mSpin->value();
195} 195}
196 196
197QLabel *KPrefsWidTime::label() 197QLabel *KPrefsWidTime::label()
198{ 198{
199 return mLabel; 199 return mLabel;
200} 200}
201 201
202QSpinBox *KPrefsWidTime::spinBox() 202QSpinBox *KPrefsWidTime::spinBox()
203{ 203{
204 return mSpin; 204 return mSpin;
205} 205}
206 206
207 207
208KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference, 208KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference,
209 QWidget *parent) 209 QWidget *parent)
210{ 210{
211 mReference = reference; 211 mReference = reference;
212 212
213 mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); 213 mBox = new QButtonGroup(1,Qt::Horizontal,text,parent);
214} 214}
215 215
216KPrefsWidRadios::~KPrefsWidRadios() 216KPrefsWidRadios::~KPrefsWidRadios()
217{ 217{
218} 218}
219 219
220void KPrefsWidRadios::addRadio(const QString &text) 220void KPrefsWidRadios::addRadio(const QString &text)
221{ 221{
222 new QRadioButton(text,mBox); 222 new QRadioButton(text,mBox);
223} 223}
224 224
225QButtonGroup *KPrefsWidRadios::groupBox() 225QButtonGroup *KPrefsWidRadios::groupBox()
226{ 226{
227 return mBox; 227 return mBox;
228} 228}
229 229
230void KPrefsWidRadios::readConfig() 230void KPrefsWidRadios::readConfig()
231{ 231{
232 mBox->setButton(*mReference); 232 mBox->setButton(*mReference);
233} 233}
234 234
235void KPrefsWidRadios::writeConfig() 235void KPrefsWidRadios::writeConfig()
236{ 236{
237 *mReference = mBox->id(mBox->selected()); 237 *mReference = mBox->id(mBox->selected());
238} 238}
239 239
240 240
241KPrefsWidString::KPrefsWidString(const QString &text,QString *reference, 241KPrefsWidString::KPrefsWidString(const QString &text,QString *reference,
242 QWidget *parent, QLineEdit::EchoMode echomode) 242 QWidget *parent, QLineEdit::EchoMode echomode)
243{ 243{
244 mReference = reference; 244 mReference = reference;
245 245
246 mLabel = new QLabel(text,parent); 246 mLabel = new QLabel(text,parent);
247 mEdit = new QLineEdit(parent); 247 mEdit = new QLineEdit(parent);
248 mEdit->setEchoMode( echomode ); 248 mEdit->setEchoMode( echomode );
249} 249}
250 250
251KPrefsWidString::~KPrefsWidString() 251KPrefsWidString::~KPrefsWidString()
252{ 252{
253} 253}
254 254
255void KPrefsWidString::readConfig() 255void KPrefsWidString::readConfig()
256{ 256{
257 mEdit->setText(*mReference); 257 mEdit->setText(*mReference);
258} 258}
259 259
260void KPrefsWidString::writeConfig() 260void KPrefsWidString::writeConfig()
261{ 261{
262 *mReference = mEdit->text(); 262 *mReference = mEdit->text();
263} 263}
264 264
265QLabel *KPrefsWidString::label() 265QLabel *KPrefsWidString::label()
266{ 266{
267 return mLabel; 267 return mLabel;
268} 268}
269 269
270QLineEdit *KPrefsWidString::lineEdit() 270QLineEdit *KPrefsWidString::lineEdit()
271{ 271{
272 return mEdit; 272 return mEdit;
273} 273}
274 274
275 275
276KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) : 276KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) :
277 KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent, 277 KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent,
278 name,modal,true) 278 name,modal,true)
279{ 279{
280 mPrefs = prefs; 280 mPrefs = prefs;
281 281
282// This seems to cause a crash on exit. Investigate later. 282// This seems to cause a crash on exit. Investigate later.
283// mPrefsWids.setAutoDelete(true); 283// mPrefsWids.setAutoDelete(true);
284 284
285 connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault())); 285 connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault()));
286 //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault())); 286 //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault()));
287 //connect(this,SIGNAL(cancelClicked()),SLOT(reject())); 287 //connect(this,SIGNAL(cancelClicked()),SLOT(reject()));
288} 288}
289 289
290KPrefsDialog::~KPrefsDialog() 290KPrefsDialog::~KPrefsDialog()
291{ 291{
292} 292}
293 293
294void KPrefsDialog::addWid(KPrefsWid *wid) 294void KPrefsDialog::addWid(KPrefsWid *wid)
295{ 295{
296 mPrefsWids.append(wid); 296 mPrefsWids.append(wid);
297} 297}
298 298
299KPrefsWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent) 299KPrefsWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent)
300{ 300{
301 KPrefsWidBool *w = new KPrefsWidBool(text,reference,parent); 301 KPrefsWidBool *w = new KPrefsWidBool(text,reference,parent);
302 addWid(w); 302 addWid(w);
303 return w; 303 return w;
304} 304}
305 305
306KPrefsWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent) 306KPrefsWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent)
307{ 307{
308 KPrefsWidTime *w = new KPrefsWidTime(text,reference,parent); 308 KPrefsWidTime *w = new KPrefsWidTime(text,reference,parent);
309 addWid(w); 309 addWid(w);
310 return w; 310 return w;
311} 311}
312 312
313KPrefsWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent) 313KPrefsWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent)
314{ 314{
315 KPrefsWidColor *w = new KPrefsWidColor(text,reference,parent); 315 KPrefsWidColor *w = new KPrefsWidColor(text,reference,parent);
316 addWid(w); 316 addWid(w);
317 return w; 317 return w;
318} 318}
319 319
320KPrefsWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent) 320KPrefsWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent)
321{ 321{
322 KPrefsWidRadios *w = new KPrefsWidRadios(text,reference,parent); 322 KPrefsWidRadios *w = new KPrefsWidRadios(text,reference,parent);
323 addWid(w); 323 addWid(w);
324 return w; 324 return w;
325} 325}
326 326
327KPrefsWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent) 327KPrefsWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent)
328{ 328{
329 KPrefsWidString *w = new KPrefsWidString(text,reference,parent); 329 KPrefsWidString *w = new KPrefsWidString(text,reference,parent);
330 addWid(w); 330 addWid(w);
331 return w; 331 return w;
332} 332}
333 333
334KPrefsWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent) 334KPrefsWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent)
335{ 335{
336 KPrefsWidString *w = new KPrefsWidString(text,reference,parent,QLineEdit::Password); 336 KPrefsWidString *w = new KPrefsWidString(text,reference,parent,QLineEdit::Password);
337 addWid(w); 337 addWid(w);
338 return w; 338 return w;
339} 339}
340 340
341KPrefsWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText, 341KPrefsWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText,
342 QFont *reference,QWidget *parent) 342 QFont *reference,QWidget *parent)
343{ 343{
344 KPrefsWidFont *w = new KPrefsWidFont(sampleText,buttonText,reference,parent); 344 KPrefsWidFont *w = new KPrefsWidFont(sampleText,buttonText,reference,parent);
345 addWid(w); 345 addWid(w);
346 return w; 346 return w;
347} 347}
348 348
349void KPrefsDialog::setDefaults() 349void KPrefsDialog::setDefaults()
350{ 350{
351 mPrefs->setDefaults(); 351 mPrefs->setDefaults();
352 352
353 readConfig(); 353 readConfig();
354} 354}
355 355
356void KPrefsDialog::readConfig() 356void KPrefsDialog::readConfig()
357{ 357{
358// kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; 358// kdDebug(5300) << "KPrefsDialog::readConfig()" << endl;
359 359
360 KPrefsWid *wid; 360 KPrefsWid *wid;
361 for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { 361 for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) {
362 wid->readConfig(); 362 wid->readConfig();
363 } 363 }
364 364
365 usrReadConfig(); 365 usrReadConfig();
366} 366}
367 367
368void KPrefsDialog::writeConfig() 368void KPrefsDialog::writeConfig()
369{ 369{
370// kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; 370// kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl;
371 371
372 KPrefsWid *wid; 372 KPrefsWid *wid;
373 for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { 373 for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) {
374 wid->writeConfig(); 374 wid->writeConfig();
375 } 375 }
376 376
377 usrWriteConfig(); 377 usrWriteConfig();
378 378
379// kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; 379// kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl;
380 380
381 mPrefs->writeConfig(); 381 mPrefs->writeConfig();
382 382
383// kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; 383// kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl;
384} 384}
385 385
386 386
387void KPrefsDialog::slotApply() 387void KPrefsDialog::slotApply()
388{ 388{
389 writeConfig(); 389 writeConfig();
390 emit configChanged(); 390 emit configChanged();
391} 391}
392 392
393void KPrefsDialog::slotOk() 393void KPrefsDialog::slotOk()
394{ 394{
395 slotApply(); 395 slotApply();
396 QDialog::accept(); 396 QDialog::accept();
397} 397}
398void KPrefsDialog::accept() 398void KPrefsDialog::accept()
399{ 399{
400 slotOk(); 400 slotOk();
401} 401}
402 402
403void KPrefsDialog::slotDefault() 403void KPrefsDialog::slotDefault()
404{ 404{
405 if (KMessageBox::warningContinueCancel(this, 405 if (KMessageBox::warningContinueCancel(this,
406 i18n("You are about to set all\npreferences to default values.\nAll " 406 i18n("You are about to set all\npreferences to default values.\nAll "
407 "custom modifications will be lost."),i18n("Setting Default Preferences"), 407 "custom modifications will be lost."),i18n("Setting Default Preferences"),
408 i18n("Continue")) 408 i18n("Continue"))
409 == KMessageBox::Continue) setDefaults(); 409 == KMessageBox::Continue) setDefaults();
410} 410}
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro
index 05abaa5..414ac2b 100644
--- a/libkdepim/libkdepimE.pro
+++ b/libkdepim/libkdepimE.pro
@@ -1,43 +1,44 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3TARGET = microkdepim 3TARGET = microkdepim
4INCLUDEPATH += ../microkde ../qtcompat ../libkabcwrap ../microkde/kdecore 4INCLUDEPATH += ../microkde ../qtcompat ../libkabcwrap ../microkde/kdecore
5INCLUDEPATH += . .. 5INCLUDEPATH += . ..
6LIBS += -lmicrokde 6LIBS += -lmicrokde
7LIBS += -L$(QPEDIR)/lib
7OBJECTS_DIR = obj/$(PLATFORM) 8OBJECTS_DIR = obj/$(PLATFORM)
8MOC_DIR = moc/$(PLATFORM) 9MOC_DIR = moc/$(PLATFORM)
9DESTDIR=$(QPEDIR)/lib 10DESTDIR=$(QPEDIR)/lib
10 11
11 12
12INTERFACES = \ 13INTERFACES = \
13 14
14HEADERS = \ 15HEADERS = \
15 categoryeditdialog.h \ 16 categoryeditdialog.h \
16 categoryeditdialog_base.h \ 17 categoryeditdialog_base.h \
17 categoryselectdialog.h \ 18 categoryselectdialog.h \
18 categoryselectdialog_base.h \ 19 categoryselectdialog_base.h \
19 kdateedit.h \ 20 kdateedit.h \
20 kdatepicker.h \ 21 kdatepicker.h \
21 kinputdialog.h \ 22 kinputdialog.h \
22 kincidenceformatter.h \ 23 kincidenceformatter.h \
23 kpimprefs.h \ 24 kpimprefs.h \
24 kprefs.h \ 25 kprefs.h \
25 kprefsdialog.h \ 26 kprefsdialog.h \
26 addresseeview.h \ 27 addresseeview.h \
27 ksyncprofile.h 28 ksyncprofile.h
28 29
29 30
30SOURCES = \ 31SOURCES = \
31 categoryeditdialog.cpp \ 32 categoryeditdialog.cpp \
32 categoryeditdialog_base.cpp \ 33 categoryeditdialog_base.cpp \
33 categoryselectdialog.cpp \ 34 categoryselectdialog.cpp \
34 categoryselectdialog_base.cpp \ 35 categoryselectdialog_base.cpp \
35 kdateedit.cpp \ 36 kdateedit.cpp \
36 kinputdialog.cpp \ 37 kinputdialog.cpp \
37 kdatepicker.cpp \ 38 kdatepicker.cpp \
38 kincidenceformatter.cpp \ 39 kincidenceformatter.cpp \
39 kpimprefs.cpp \ 40 kpimprefs.cpp \
40 kprefs.cpp \ 41 kprefs.cpp \
41 kprefsdialog.cpp \ 42 kprefsdialog.cpp \
42 addresseeview.cpp \ 43 addresseeview.cpp \
43 ksyncprofile.cpp 44 ksyncprofile.cpp