-rw-r--r-- | kaddressbook/kabprefs.cpp | 4 | ||||
-rw-r--r-- | kalarmd/alarmdialog.cpp | 9 | ||||
-rw-r--r-- | kmicromail/koprefs.cpp | 11 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 12 | ||||
-rw-r--r-- | microkde/kdatetbl.cpp | 2 |
5 files changed, 15 insertions, 23 deletions
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index a2095d4..01e84d0 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp | |||
@@ -1,155 +1,155 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
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 | //US#ifdef KAB_EMBEDDED | 24 | //US#ifdef KAB_EMBEDDED |
25 | //#include <qstring.h> | 25 | //#include <qstring.h> |
26 | //#endif //KAB_EMBEDDED | 26 | //#endif //KAB_EMBEDDED |
27 | 27 | ||
28 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qregexp.h> | 30 | #include <qregexp.h> |
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #include <libkdepim/kpimglobalprefs.h> | 32 | #include <libkdepim/kpimglobalprefs.h> |
33 | 33 | ||
34 | #include <kconfig.h> | 34 | #include <kconfig.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kstaticdeleter.h> | 36 | #include <kstaticdeleter.h> |
37 | #include <kglobalsettings.h> | ||
37 | //US#include <kdebug.h> // defines kdDebug() | 38 | //US#include <kdebug.h> // defines kdDebug() |
38 | 39 | ||
39 | #include "kabprefs.h" | 40 | #include "kabprefs.h" |
40 | 41 | ||
41 | #ifdef DESKTOP_VERSION | 42 | #ifdef DESKTOP_VERSION |
42 | #include <qapplication.h> | 43 | #include <qapplication.h> |
43 | #endif | 44 | #endif |
44 | 45 | ||
45 | KABPrefs *KABPrefs::sInstance = 0; | 46 | KABPrefs *KABPrefs::sInstance = 0; |
46 | static KStaticDeleter<KABPrefs> staticDeleterAB; | 47 | static KStaticDeleter<KABPrefs> staticDeleterAB; |
47 | 48 | ||
48 | KABPrefs::KABPrefs() | 49 | KABPrefs::KABPrefs() |
49 | : KPimPrefs("kaddressbookrc") | 50 | : KPimPrefs("kaddressbookrc") |
50 | { | 51 | { |
51 | mDetailsFont = QFont("helvetica",12); | ||
52 | KPrefs::setCurrentGroup( "Views" ); | 52 | KPrefs::setCurrentGroup( "Views" ); |
53 | addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); | 53 | addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); |
54 | 54 | ||
55 | KPrefs::setCurrentGroup( "General" ); | 55 | KPrefs::setCurrentGroup( "General" ); |
56 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); | 56 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); |
57 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); | 57 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); |
58 | 58 | ||
59 | #ifdef KAB_EMBEDDED | 59 | #ifdef KAB_EMBEDDED |
60 | addItemBool("AskForQuit",&mAskForQuit,true); | 60 | addItemBool("AskForQuit",&mAskForQuit,true); |
61 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 61 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
62 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 62 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
63 | addItemBool("SearchWithReturn",&mSearchWithReturn, false ); | 63 | addItemBool("SearchWithReturn",&mSearchWithReturn, false ); |
64 | addItemFont("DetailsFont",&mDetailsFont); | 64 | addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont()); |
65 | 65 | ||
66 | 66 | ||
67 | #endif //KAB_EMBEDDED | 67 | #endif //KAB_EMBEDDED |
68 | 68 | ||
69 | KPrefs::setCurrentGroup( "MainWindow" ); | 69 | KPrefs::setCurrentGroup( "MainWindow" ); |
70 | bool m_visible = false; | 70 | bool m_visible = false; |
71 | #ifdef DESKTOP_VERSION | 71 | #ifdef DESKTOP_VERSION |
72 | m_visible = true; | 72 | m_visible = true; |
73 | #endif | 73 | #endif |
74 | addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible ); | 74 | addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible ); |
75 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); | 75 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); |
76 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); | 76 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); |
77 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); | 77 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); |
78 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); | 78 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); |
79 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); | 79 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); |
80 | 80 | ||
81 | 81 | ||
82 | KPrefs::setCurrentGroup( "Extensions_General" ); | 82 | KPrefs::setCurrentGroup( "Extensions_General" ); |
83 | QStringList defaultExtensions; | 83 | QStringList defaultExtensions; |
84 | defaultExtensions << "merge"; | 84 | defaultExtensions << "merge"; |
85 | defaultExtensions << "distribution_list_editor"; | 85 | defaultExtensions << "distribution_list_editor"; |
86 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); | 86 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); |
87 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); | 87 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); |
88 | 88 | ||
89 | KPrefs::setCurrentGroup( "Views" ); | 89 | KPrefs::setCurrentGroup( "Views" ); |
90 | QString defaultView = i18n( "Default Table View" ); | 90 | QString defaultView = i18n( "Default Table View" ); |
91 | addItemString( "CurrentView", &mCurrentView, defaultView ); | 91 | addItemString( "CurrentView", &mCurrentView, defaultView ); |
92 | addItemStringList( "ViewNames", &mViewNames, defaultView ); | 92 | addItemStringList( "ViewNames", &mViewNames, defaultView ); |
93 | 93 | ||
94 | KPrefs::setCurrentGroup( "Filters" ); | 94 | KPrefs::setCurrentGroup( "Filters" ); |
95 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); | 95 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); |
96 | 96 | ||
97 | } | 97 | } |
98 | 98 | ||
99 | KABPrefs::~KABPrefs() | 99 | KABPrefs::~KABPrefs() |
100 | { | 100 | { |
101 | //qDebug("KABPrefs::~KABPrefs() "); | 101 | //qDebug("KABPrefs::~KABPrefs() "); |
102 | if (sInstance == this) | 102 | if (sInstance == this) |
103 | sInstance = staticDeleterAB.setObject(0); | 103 | sInstance = staticDeleterAB.setObject(0); |
104 | } | 104 | } |
105 | 105 | ||
106 | KABPrefs *KABPrefs::instance() | 106 | KABPrefs *KABPrefs::instance() |
107 | { | 107 | { |
108 | if ( !sInstance ) { | 108 | if ( !sInstance ) { |
109 | #ifdef KAB_EMBEDDED | 109 | #ifdef KAB_EMBEDDED |
110 | sInstance = staticDeleterAB.setObject( new KABPrefs() ); | 110 | sInstance = staticDeleterAB.setObject( new KABPrefs() ); |
111 | #else //KAB_EMBEDDED | 111 | #else //KAB_EMBEDDED |
112 | //US the following line has changed ???. Why | 112 | //US the following line has changed ???. Why |
113 | staticDeleterAB.setObject( sInstance, new KABPrefs() ); | 113 | staticDeleterAB.setObject( sInstance, new KABPrefs() ); |
114 | #endif //KAB_EMBEDDED | 114 | #endif //KAB_EMBEDDED |
115 | sInstance->readConfig(); | 115 | sInstance->readConfig(); |
116 | } | 116 | } |
117 | 117 | ||
118 | return sInstance; | 118 | return sInstance; |
119 | } | 119 | } |
120 | 120 | ||
121 | void KABPrefs::setCategoryDefaults() | 121 | void KABPrefs::setCategoryDefaults() |
122 | { | 122 | { |
123 | mCustomCategories.clear(); | 123 | mCustomCategories.clear(); |
124 | 124 | ||
125 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) | 125 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) |
126 | << i18n( "Customer" ) << i18n( "Friend" ); | 126 | << i18n( "Customer" ) << i18n( "Friend" ); |
127 | } | 127 | } |
128 | 128 | ||
129 | // US introduce a nonconst way to return the config object. | 129 | // US introduce a nonconst way to return the config object. |
130 | KConfig* KABPrefs::getConfig() | 130 | KConfig* KABPrefs::getConfig() |
131 | { | 131 | { |
132 | return config(); | 132 | return config(); |
133 | } | 133 | } |
134 | void KABPrefs::usrReadConfig() | 134 | void KABPrefs::usrReadConfig() |
135 | { | 135 | { |
136 | KPimPrefs::usrReadConfig(); | 136 | KPimPrefs::usrReadConfig(); |
137 | } | 137 | } |
138 | 138 | ||
139 | 139 | ||
140 | /*US | 140 | /*US |
141 | void KABPrefs::usrSetDefaults() | 141 | void KABPrefs::usrSetDefaults() |
142 | { | 142 | { |
143 | KPimPrefs::usrSetDefaults(); | 143 | KPimPrefs::usrSetDefaults(); |
144 | } | 144 | } |
145 | 145 | ||
146 | void KABPrefs::usrReadConfig() | 146 | void KABPrefs::usrReadConfig() |
147 | { | 147 | { |
148 | KPimPrefs::usrReadConfig(); | 148 | KPimPrefs::usrReadConfig(); |
149 | } | 149 | } |
150 | 150 | ||
151 | void KABPrefs::usrWriteConfig() | 151 | void KABPrefs::usrWriteConfig() |
152 | { | 152 | { |
153 | KPimPrefs::usrWriteConfig(); | 153 | KPimPrefs::usrWriteConfig(); |
154 | } | 154 | } |
155 | */ | 155 | */ |
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp index 521781e..751ba57 100644 --- a/kalarmd/alarmdialog.cpp +++ b/kalarmd/alarmdialog.cpp | |||
@@ -1,258 +1,261 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the KDE alarm daemon. | 2 | This file is part of the KDE alarm daemon. |
3 | Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000 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 <qhbox.h> | 26 | #include <qhbox.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qapp.h> | 28 | #include <qapp.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qlayout.h> | 30 | #include <qlayout.h> |
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | #include <qsound.h> | 33 | #include <qsound.h> |
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | #include <qspinbox.h> | 35 | #include <qspinbox.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | #ifndef _WIN32_ | 37 | #ifndef _WIN32_ |
38 | #include <unistd.h> | 38 | #include <unistd.h> |
39 | #include <sys/ioctl.h> | 39 | #include <sys/ioctl.h> |
40 | #endif | 40 | #endif |
41 | #include <stdio.h> | 41 | #include <stdio.h> |
42 | #include <fcntl.h> | 42 | #include <fcntl.h> |
43 | 43 | ||
44 | #ifndef DESKTOP_VERSION | 44 | #ifndef DESKTOP_VERSION |
45 | #include <qtopia/alarmserver.h> | 45 | #include <qtopia/alarmserver.h> |
46 | #include <qpe/resource.h> | 46 | #include <qpe/resource.h> |
47 | #include <qtopia/sound.h> | 47 | #include <qtopia/sound.h> |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #include "alarmdialog.h" | 50 | #include "alarmdialog.h" |
51 | 51 | ||
52 | 52 | ||
53 | AlarmDialog::AlarmDialog(QWidget *parent,const char *name) | 53 | AlarmDialog::AlarmDialog(QWidget *parent,const char *name) |
54 | : QDialog (parent, name, true, Qt::WStyle_StaysOnTop ) | 54 | : QDialog (parent, name, true, Qt::WStyle_StaysOnTop ) |
55 | { | 55 | { |
56 | setCaption( "KO/Pi Alarm!" ); | 56 | setCaption( "KO/Pi Alarm!" ); |
57 | QVBoxLayout* layout = new QVBoxLayout( this); | 57 | QVBoxLayout* layout = new QVBoxLayout( this); |
58 | QLabel* l = new QLabel("The following event triggered alarm:",this); | 58 | QLabel* l = new QLabel("The following event triggered alarm:",this); |
59 | layout->addWidget ( l ); | 59 | layout->addWidget ( l ); |
60 | l->setAlignment( AlignCenter); | 60 | l->setAlignment( AlignCenter); |
61 | mMessage = new QLabel ( " ", this ); | 61 | mMessage = new QLabel ( " ", this ); |
62 | int fs = 18; | 62 | int fs = 18; |
63 | int fs2 = 12; | 63 | int fs2 = 12; |
64 | if ( QApplication::desktop()->width() < 480 ) { | 64 | if ( QApplication::desktop()->width() < 480 ) { |
65 | setMaximumSize(220, 260); | 65 | setMaximumSize(220, 260); |
66 | fs2 = 10; | 66 | fs2 = 10; |
67 | } | 67 | } |
68 | else { | 68 | else { |
69 | setMaximumSize(440, 440); | 69 | setMaximumSize(440, 440); |
70 | } | 70 | } |
71 | layout->setSpacing( 3 ); | 71 | layout->setSpacing( 3 ); |
72 | layout->setMargin( 3 ); | 72 | layout->setMargin( 3 ); |
73 | 73 | QFont fo = QApplication::font(); | |
74 | l->setFont( QFont("helvetica",fs2, QFont::Bold) ); | 74 | fo.setBold( true ); |
75 | mMessage->setFont( QFont("helvetica",fs, QFont::Bold) ); | 75 | fo.setPointSize( fs2 ); |
76 | l->setFont( fo ); | ||
77 | fo.setPointSize( fs ); | ||
78 | mMessage->setFont(fo ); | ||
76 | mMessage->setAlignment( AlignCenter); | 79 | mMessage->setAlignment( AlignCenter); |
77 | l = new QLabel("Missed Alarms:",this); | 80 | l = new QLabel("Missed Alarms:",this); |
78 | l->setAlignment( AlignCenter); | 81 | l->setAlignment( AlignCenter); |
79 | layout->addWidget ( mMessage ); | 82 | layout->addWidget ( mMessage ); |
80 | layout->addWidget ( l ); | 83 | layout->addWidget ( l ); |
81 | mMissedAlarms= new QLabel ( "", this ); | 84 | mMissedAlarms= new QLabel ( "", this ); |
82 | mMissedAlarms->setAlignment( AlignCenter); | 85 | mMissedAlarms->setAlignment( AlignCenter); |
83 | 86 | ||
84 | playSoundTimer = new QTimer( this ); | 87 | playSoundTimer = new QTimer( this ); |
85 | connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) ); | 88 | connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) ); |
86 | 89 | ||
87 | playSoundTimer->stop(); | 90 | playSoundTimer->stop(); |
88 | 91 | ||
89 | layout->addWidget ( mMissedAlarms ); | 92 | layout->addWidget ( mMissedAlarms ); |
90 | QHBox *suspendBox = new QHBox( this ); | 93 | QHBox *suspendBox = new QHBox( this ); |
91 | suspendBox->setSpacing(3); | 94 | suspendBox->setSpacing(3); |
92 | layout->addWidget ( suspendBox ); | 95 | layout->addWidget ( suspendBox ); |
93 | (void)new QLabel("Suspend duration (minutes):",suspendBox); | 96 | (void)new QLabel("Suspend duration (minutes):",suspendBox); |
94 | mSuspendSpin = new QSpinBox(1,1440,1,suspendBox); | 97 | mSuspendSpin = new QSpinBox(1,1440,1,suspendBox); |
95 | mSuspendSpin->setValue(7); // default suspend duration | 98 | mSuspendSpin->setValue(7); // default suspend duration |
96 | QHBox * bbox = new QHBox ( this ); | 99 | QHBox * bbox = new QHBox ( this ); |
97 | layout->addWidget ( bbox ); | 100 | layout->addWidget ( bbox ); |
98 | bbox->layout()->setSpacing( 5 ); | 101 | bbox->layout()->setSpacing( 5 ); |
99 | QPushButton* suspend = new QPushButton( "Suspend", bbox); | 102 | QPushButton* suspend = new QPushButton( "Suspend", bbox); |
100 | QPushButton* silen = new QPushButton( " Stop sound ", bbox); | 103 | QPushButton* silen = new QPushButton( " Stop sound ", bbox); |
101 | QPushButton* okbut = new QPushButton( "Ok", bbox); | 104 | QPushButton* okbut = new QPushButton( "Ok", bbox); |
102 | connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); | 105 | connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); |
103 | connect (suspend , SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); | 106 | connect (suspend , SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); |
104 | connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) ); | 107 | connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) ); |
105 | #ifndef _WIN32_ | 108 | #ifndef _WIN32_ |
106 | if ( QFile::exists ( "/dev/sharp_led" ) ) | 109 | if ( QFile::exists ( "/dev/sharp_led" ) ) |
107 | fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); | 110 | fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); |
108 | else | 111 | else |
109 | #endif | 112 | #endif |
110 | fd_led = 0; | 113 | fd_led = 0; |
111 | statusLED.which = SHARP_LED_SALARM; | 114 | statusLED.which = SHARP_LED_SALARM; |
112 | mSilent = false; | 115 | mSilent = false; |
113 | mSuspendCounter = 0; | 116 | mSuspendCounter = 0; |
114 | setServerNotification( true ); | 117 | setServerNotification( true ); |
115 | } | 118 | } |
116 | void AlarmDialog::reject () | 119 | void AlarmDialog::reject () |
117 | { | 120 | { |
118 | QTimer::singleShot ( 3000, this, SLOT (suspend()) ); | 121 | QTimer::singleShot ( 3000, this, SLOT (suspend()) ); |
119 | slotSuspend(); | 122 | slotSuspend(); |
120 | } | 123 | } |
121 | AlarmDialog::~AlarmDialog() | 124 | AlarmDialog::~AlarmDialog() |
122 | { | 125 | { |
123 | } | 126 | } |
124 | void AlarmDialog::silent () | 127 | void AlarmDialog::silent () |
125 | { | 128 | { |
126 | mSilent = true; | 129 | mSilent = true; |
127 | } | 130 | } |
128 | void AlarmDialog::accept() | 131 | void AlarmDialog::accept() |
129 | { | 132 | { |
130 | slotOk(); | 133 | slotOk(); |
131 | } | 134 | } |
132 | 135 | ||
133 | void AlarmDialog::suspend() | 136 | void AlarmDialog::suspend() |
134 | { | 137 | { |
135 | #ifdef DESKTOP_VERSION | 138 | #ifdef DESKTOP_VERSION |
136 | 139 | ||
137 | #else | 140 | #else |
138 | Sound::soundAlarm (); | 141 | Sound::soundAlarm (); |
139 | #endif | 142 | #endif |
140 | } | 143 | } |
141 | void AlarmDialog::slotOk() | 144 | void AlarmDialog::slotOk() |
142 | { | 145 | { |
143 | mStopAlarm = true; | 146 | mStopAlarm = true; |
144 | mMissedAlarms->setText(""); | 147 | mMissedAlarms->setText(""); |
145 | mMessage->setText(""); | 148 | mMessage->setText(""); |
146 | #ifndef _WIN32_ | 149 | #ifndef _WIN32_ |
147 | if ( fd_led > 0 ) { | 150 | if ( fd_led > 0 ) { |
148 | statusLED.status = LED_SALARM_OFF ; | 151 | statusLED.status = LED_SALARM_OFF ; |
149 | ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); | 152 | ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); |
150 | } | 153 | } |
151 | #endif | 154 | #endif |
152 | QDialog::accept(); | 155 | QDialog::accept(); |
153 | } | 156 | } |
154 | 157 | ||
155 | void AlarmDialog::slotSuspend() | 158 | void AlarmDialog::slotSuspend() |
156 | { | 159 | { |
157 | //qDebug("AlarmDialog::suspend() "); // emit suspendSignal(mSuspendSpin->value()); | 160 | //qDebug("AlarmDialog::suspend() "); // emit suspendSignal(mSuspendSpin->value()); |
158 | mStopAlarm = true; | 161 | mStopAlarm = true; |
159 | QDateTime nextA = QDateTime::currentDateTime().addSecs( mSuspendSpin->value() * 60 ); | 162 | QDateTime nextA = QDateTime::currentDateTime().addSecs( mSuspendSpin->value() * 60 ); |
160 | QString mess = "suspend_alarm" +mFileName+"+++" ; | 163 | QString mess = "suspend_alarm" +mFileName+"+++" ; |
161 | if ( mMessage->text().left( 10 ) !="Suspended:" ) | 164 | if ( mMessage->text().left( 10 ) !="Suspended:" ) |
162 | mess += "Suspended:\n"; | 165 | mess += "Suspended:\n"; |
163 | mess +=mMessage->text(); | 166 | mess +=mMessage->text(); |
164 | #ifndef DESKTOP_VERSION | 167 | #ifndef DESKTOP_VERSION |
165 | if ( mServerNotification ) | 168 | if ( mServerNotification ) |
166 | AlarmServer::addAlarm ( nextA,"koalarm",mess.latin1()); | 169 | AlarmServer::addAlarm ( nextA,"koalarm",mess.latin1()); |
167 | #endif | 170 | #endif |
168 | emit addAlarm( nextA , mess ); | 171 | emit addAlarm( nextA , mess ); |
169 | slotOk(); | 172 | slotOk(); |
170 | } | 173 | } |
171 | 174 | ||
172 | void AlarmDialog::setServerNotification( bool b ) | 175 | void AlarmDialog::setServerNotification( bool b ) |
173 | { | 176 | { |
174 | mServerNotification = b; | 177 | mServerNotification = b; |
175 | } | 178 | } |
176 | int AlarmDialog::getSuspendTime( ) | 179 | int AlarmDialog::getSuspendTime( ) |
177 | { | 180 | { |
178 | return mSuspendSpin->value(); | 181 | return mSuspendSpin->value(); |
179 | 182 | ||
180 | } | 183 | } |
181 | void AlarmDialog::setSuspendTime( int val ) | 184 | void AlarmDialog::setSuspendTime( int val ) |
182 | { | 185 | { |
183 | mSuspendSpin->setValue( val ); | 186 | mSuspendSpin->setValue( val ); |
184 | } | 187 | } |
185 | bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, bool playwav, int pause , int suspendtimes) | 188 | bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, bool playwav, int pause , int suspendtimes) |
186 | { | 189 | { |
187 | if ( mess.left( 9) != "Suspended" ) | 190 | if ( mess.left( 9) != "Suspended" ) |
188 | mSuspendCounter = suspendtimes; | 191 | mSuspendCounter = suspendtimes; |
189 | mPauseCount = pause; | 192 | mPauseCount = pause; |
190 | mFileName = fn; | 193 | mFileName = fn; |
191 | mPlayWav = playwav; | 194 | mPlayWav = playwav; |
192 | if ( !QFile::exists( fn ) ) | 195 | if ( !QFile::exists( fn ) ) |
193 | mFileName = ""; | 196 | mFileName = ""; |
194 | alarmCounter = 0 ; | 197 | alarmCounter = 0 ; |
195 | maxAlarmReplay = replay ; | 198 | maxAlarmReplay = replay ; |
196 | mStopAlarm = false; | 199 | mStopAlarm = false; |
197 | mSilent = false; | 200 | mSilent = false; |
198 | if ( mMissedAlarms->text() == "" ) | 201 | if ( mMissedAlarms->text() == "" ) |
199 | mMissedAlarms->setText( mMessage->text()); | 202 | mMissedAlarms->setText( mMessage->text()); |
200 | else | 203 | else |
201 | mMissedAlarms->setText( mMessage->text()+ "\n" + mMissedAlarms->text() ); | 204 | mMissedAlarms->setText( mMessage->text()+ "\n" + mMissedAlarms->text() ); |
202 | if ( mMissedAlarms->text().length() > 180 ) | 205 | if ( mMissedAlarms->text().length() > 180 ) |
203 | mMissedAlarms->setText(mMissedAlarms->text().left ( 180 )); | 206 | mMissedAlarms->setText(mMissedAlarms->text().left ( 180 )); |
204 | mMessage->setText(mess); | 207 | mMessage->setText(mess); |
205 | int w =sizeHint().width() ; | 208 | int w =sizeHint().width() ; |
206 | int h = sizeHint().height() ; | 209 | int h = sizeHint().height() ; |
207 | int dw = QApplication::desktop()->width(); | 210 | int dw = QApplication::desktop()->width(); |
208 | int dh = QApplication::desktop()->height(); | 211 | int dh = QApplication::desktop()->height(); |
209 | setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 212 | setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
210 | show(); | 213 | show(); |
211 | raise(); | 214 | raise(); |
212 | qApp->processEvents(); | 215 | qApp->processEvents(); |
213 | repaint(); | 216 | repaint(); |
214 | qApp->processEvents(); | 217 | qApp->processEvents(); |
215 | 218 | ||
216 | #ifndef _WIN32_ | 219 | #ifndef _WIN32_ |
217 | if ( fd_led > 0 ) { | 220 | if ( fd_led > 0 ) { |
218 | statusLED.status = LED_SALARM_ON ; | 221 | statusLED.status = LED_SALARM_ON ; |
219 | ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); | 222 | ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); |
220 | } | 223 | } |
221 | #endif | 224 | #endif |
222 | playSoundTimer->start( 1000, true ); | 225 | playSoundTimer->start( 1000, true ); |
223 | return true; | 226 | return true; |
224 | 227 | ||
225 | } | 228 | } |
226 | 229 | ||
227 | 230 | ||
228 | void AlarmDialog::playSound () | 231 | void AlarmDialog::playSound () |
229 | { | 232 | { |
230 | if (mStopAlarm ) | 233 | if (mStopAlarm ) |
231 | return; | 234 | return; |
232 | showNormal(); | 235 | showNormal(); |
233 | setActiveWindow(); | 236 | setActiveWindow(); |
234 | setFocus(); | 237 | setFocus(); |
235 | raise(); | 238 | raise(); |
236 | 239 | ||
237 | qApp->processEvents(); | 240 | qApp->processEvents(); |
238 | if ( alarmCounter < maxAlarmReplay && ! mSilent) { | 241 | if ( alarmCounter < maxAlarmReplay && ! mSilent) { |
239 | ++alarmCounter; | 242 | ++alarmCounter; |
240 | if ( !mPlayWav || mFileName.length() < 2 ) { | 243 | if ( !mPlayWav || mFileName.length() < 2 ) { |
241 | 244 | ||
242 | #ifndef DESKTOP_VERSION | 245 | #ifndef DESKTOP_VERSION |
243 | Sound::soundAlarm (); | 246 | Sound::soundAlarm (); |
244 | #endif | 247 | #endif |
245 | } else { | 248 | } else { |
246 | QSound::play ( mFileName ); | 249 | QSound::play ( mFileName ); |
247 | //qDebug("BEEP!"); | 250 | //qDebug("BEEP!"); |
248 | } | 251 | } |
249 | } else { | 252 | } else { |
250 | if ( ! mSilent && mSuspendCounter > 0 ) { | 253 | if ( ! mSilent && mSuspendCounter > 0 ) { |
251 | --mSuspendCounter; | 254 | --mSuspendCounter; |
252 | reject (); | 255 | reject (); |
253 | hide(); | 256 | hide(); |
254 | return; | 257 | return; |
255 | } | 258 | } |
256 | } | 259 | } |
257 | playSoundTimer->start( mPauseCount * 1000, true ); | 260 | playSoundTimer->start( mPauseCount * 1000, true ); |
258 | } | 261 | } |
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp index 7b1e169..e4b61dc 100644 --- a/kmicromail/koprefs.cpp +++ b/kmicromail/koprefs.cpp | |||
@@ -1,129 +1,126 @@ | |||
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 | #include <time.h> | 24 | #include <time.h> |
25 | #ifndef _WIN32_ | 25 | #ifndef _WIN32_ |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #endif | 27 | #endif |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qtextcodec.h> | 30 | #include <qtextcodec.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <kemailsettings.h> | 42 | #include <kemailsettings.h> |
43 | #include <kstaticdeleter.h> | 43 | #include <kstaticdeleter.h> |
44 | #include <kglobalsettings.h> | ||
44 | 45 | ||
45 | #include "koprefs.h" | 46 | #include "koprefs.h" |
46 | #include "mainwindow.h" | 47 | #include "mainwindow.h" |
47 | 48 | ||
48 | 49 | ||
49 | KOPrefs *KOPrefs::mInstance = 0; | 50 | KOPrefs *KOPrefs::mInstance = 0; |
50 | static KStaticDeleter<KOPrefs> insd; | 51 | static KStaticDeleter<KOPrefs> insd; |
51 | 52 | ||
52 | KOPrefs::KOPrefs() : | 53 | KOPrefs::KOPrefs() : |
53 | KPimPrefs("kopiemailrc") | 54 | KPimPrefs("kopiemailrc") |
54 | { | 55 | { |
55 | mAppFont = QFont("helvetica",12); | ||
56 | mComposeFont = QFont("helvetica",12); | ||
57 | mReadFont = QFont("helvetica",12); | ||
58 | |||
59 | KPrefs::setCurrentGroup("General"); | 56 | KPrefs::setCurrentGroup("General"); |
60 | addItemString("SendCodec",&mSendCodec,i18n ("userdefined") ); | 57 | addItemString("SendCodec",&mSendCodec,i18n ("userdefined") ); |
61 | addItemString("SenderName",&mName,i18n ("Please set at") ); | 58 | addItemString("SenderName",&mName,i18n ("Please set at") ); |
62 | addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); | 59 | addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); |
63 | addItemBool("ViewMailAsHtml",&mViewAsHtml,false); | 60 | addItemBool("ViewMailAsHtml",&mViewAsHtml,false); |
64 | addItemBool("SendMailLater",&mSendLater,true); | 61 | addItemBool("SendMailLater",&mSendLater,true); |
65 | addItemBool("ShowToField",&mShowToField,false); | 62 | addItemBool("ShowToField",&mShowToField,false); |
66 | addItemBool("UseKapi",&mUseKapi,false); | 63 | addItemBool("UseKapi",&mUseKapi,false); |
67 | addItemInt("CurrentCodec",&mCurrentCodec,0); | 64 | addItemInt("CurrentCodec",&mCurrentCodec,0); |
68 | addItemBool("ShowInfoSub",&mShowInfoSub,true); | 65 | addItemBool("ShowInfoSub",&mShowInfoSub,true); |
69 | addItemBool("ShowInfoFrom",&mShowInfoFrom,true); | 66 | addItemBool("ShowInfoFrom",&mShowInfoFrom,true); |
70 | addItemBool("ShowInfoTo",&mShowInfoTo,true); | 67 | addItemBool("ShowInfoTo",&mShowInfoTo,true); |
71 | addItemBool("ShowInfoStart",&mShowInfoStart,true); | 68 | addItemBool("ShowInfoStart",&mShowInfoStart,true); |
72 | KPrefs::setCurrentGroup("Fonts"); | 69 | KPrefs::setCurrentGroup("Fonts"); |
73 | addItemFont("Application Font",&mAppFont); | 70 | addItemFont("Application Font",&mAppFont,KGlobalSettings::generalFont()); |
74 | addItemFont("Compose Font",&mComposeFont); | 71 | addItemFont("Compose Font",&mComposeFont,KGlobalSettings::generalFont()); |
75 | addItemFont("Read Font",&mReadFont); | 72 | addItemFont("Read Font",&mReadFont,KGlobalSettings::generalFont()); |
76 | fillMailDefaults(); | 73 | fillMailDefaults(); |
77 | isDirty = false; | 74 | isDirty = false; |
78 | } | 75 | } |
79 | 76 | ||
80 | 77 | ||
81 | KOPrefs::~KOPrefs() | 78 | KOPrefs::~KOPrefs() |
82 | { | 79 | { |
83 | if ( isDirty ) | 80 | if ( isDirty ) |
84 | writeConfig(); | 81 | writeConfig(); |
85 | if (mInstance == this) | 82 | if (mInstance == this) |
86 | mInstance = insd.setObject(0); | 83 | mInstance = insd.setObject(0); |
87 | 84 | ||
88 | } | 85 | } |
89 | 86 | ||
90 | 87 | ||
91 | KOPrefs *KOPrefs::instance() | 88 | KOPrefs *KOPrefs::instance() |
92 | { | 89 | { |
93 | if (!mInstance) { | 90 | if (!mInstance) { |
94 | mInstance = insd.setObject(new KOPrefs()); | 91 | mInstance = insd.setObject(new KOPrefs()); |
95 | mInstance->readConfig(); | 92 | mInstance->readConfig(); |
96 | } | 93 | } |
97 | 94 | ||
98 | return mInstance; | 95 | return mInstance; |
99 | } | 96 | } |
100 | 97 | ||
101 | void KOPrefs::usrSetDefaults() | 98 | void KOPrefs::usrSetDefaults() |
102 | { | 99 | { |
103 | 100 | ||
104 | } | 101 | } |
105 | 102 | ||
106 | void KOPrefs::fillMailDefaults() | 103 | void KOPrefs::fillMailDefaults() |
107 | { | 104 | { |
108 | if (mName.isEmpty()) mName = i18n ("Please set at"); | 105 | if (mName.isEmpty()) mName = i18n ("Please set at"); |
109 | if (mEmail.isEmpty()) mEmail = i18n ("Settings@General TAB"); | 106 | if (mEmail.isEmpty()) mEmail = i18n ("Settings@General TAB"); |
110 | } | 107 | } |
111 | 108 | ||
112 | void KOPrefs::usrReadConfig() | 109 | void KOPrefs::usrReadConfig() |
113 | { | 110 | { |
114 | 111 | ||
115 | KPimPrefs::usrReadConfig(); | 112 | KPimPrefs::usrReadConfig(); |
116 | } | 113 | } |
117 | 114 | ||
118 | 115 | ||
119 | void KOPrefs::usrWriteConfig() | 116 | void KOPrefs::usrWriteConfig() |
120 | { | 117 | { |
121 | KPimPrefs::usrWriteConfig(); | 118 | KPimPrefs::usrWriteConfig(); |
122 | } | 119 | } |
123 | 120 | ||
124 | 121 | ||
125 | 122 | ||
126 | KConfig* KOPrefs::getConfig() | 123 | KConfig* KOPrefs::getConfig() |
127 | { | 124 | { |
128 | return config(); | 125 | return config(); |
129 | } | 126 | } |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 5bfe2a1..7efb6a6 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -1,332 +1,322 @@ | |||
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 | #include <time.h> | 24 | #include <time.h> |
25 | #ifndef _WIN32_ | 25 | #ifndef _WIN32_ |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #endif | 27 | #endif |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qtextcodec.h> | 30 | #include <qtextcodec.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kglobalsettings.h> | 39 | #include <kglobalsettings.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <klocale.h> | 41 | #include <klocale.h> |
42 | #include <kdebug.h> | 42 | #include <kdebug.h> |
43 | #include <kemailsettings.h> | 43 | #include <kemailsettings.h> |
44 | #include <kstaticdeleter.h> | 44 | #include <kstaticdeleter.h> |
45 | #include <libkdepim/kpimglobalprefs.h> | 45 | #include <libkdepim/kpimglobalprefs.h> |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #include "mainwindow.h" | 48 | #include "mainwindow.h" |
49 | 49 | ||
50 | KOPrefs *KOPrefs::mInstance = 0; | 50 | KOPrefs *KOPrefs::mInstance = 0; |
51 | static KStaticDeleter<KOPrefs> insd; | 51 | static KStaticDeleter<KOPrefs> insd; |
52 | 52 | ||
53 | KOPrefs::KOPrefs() : | 53 | KOPrefs::KOPrefs() : |
54 | KPimPrefs("korganizerrc") | 54 | KPimPrefs("korganizerrc") |
55 | { | 55 | { |
56 | mCategoryColors.setAutoDelete(true); | 56 | mCategoryColors.setAutoDelete(true); |
57 | fillMailDefaults(); | 57 | fillMailDefaults(); |
58 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); | 58 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); |
59 | QColor defaultHolidayColor = QColor(255,0,0); | 59 | QColor defaultHolidayColor = QColor(255,0,0); |
60 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); | 60 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); |
61 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); | 61 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); |
62 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); | 62 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); |
63 | QColor defaultTodoDueTodayColor = QColor(255,220,100); | 63 | QColor defaultTodoDueTodayColor = QColor(255,220,100); |
64 | QColor defaultTodoOverdueColor = QColor(255,153,125); | 64 | QColor defaultTodoOverdueColor = QColor(255,153,125); |
65 | 65 | ||
66 | /* | 66 | |
67 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); | ||
68 | mDefaultViewFont = QFont("helvetica",10); | ||
69 | mDefaultMonthViewFont = QFont("helvetica",8); | ||
70 | mMarcusBainsFont= QFont("helvetica",10); | ||
71 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); | ||
72 | mEditBoxFont = QFont("helvetica",12); | ||
73 | mJornalViewFont = QFont("helvetica",12); | ||
74 | */ | ||
75 | |||
76 | |||
77 | KPrefs::setCurrentGroup("General"); | 67 | KPrefs::setCurrentGroup("General"); |
78 | 68 | ||
79 | 69 | ||
80 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 70 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
81 | 71 | ||
82 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | 72 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); |
83 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | 73 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); |
84 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | 74 | addItemBool("ShowIconSearch",&mShowIconSearch,true); |
85 | addItemBool("ShowIconList",&mShowIconList,true); | 75 | addItemBool("ShowIconList",&mShowIconList,true); |
86 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | 76 | addItemBool("ShowIconDay1",&mShowIconDay1,true); |
87 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | 77 | addItemBool("ShowIconDay5",&mShowIconDay5,true); |
88 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 78 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
89 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 79 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
90 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 80 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
91 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 81 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
92 | addItemBool("ShowIconBack",&mShowIconBack,true); | 82 | addItemBool("ShowIconBack",&mShowIconBack,true); |
93 | addItemBool("ShowIconToday",&mShowIconToday,true); | 83 | addItemBool("ShowIconToday",&mShowIconToday,true); |
94 | addItemBool("ShowIconForward",&mShowIconForward,true); | 84 | addItemBool("ShowIconForward",&mShowIconForward,true); |
95 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 85 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
96 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); | 86 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); |
97 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 87 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
98 | addItemBool("ShowIconNext",&mShowIconNext,true); | 88 | addItemBool("ShowIconNext",&mShowIconNext,true); |
99 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 89 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
100 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 90 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
101 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); | 91 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
102 | 92 | ||
103 | addItemBool("AskForQuit",&mAskForQuit,false); | 93 | addItemBool("AskForQuit",&mAskForQuit,false); |
104 | 94 | ||
105 | #ifndef DESKTOP_VERSION | 95 | #ifndef DESKTOP_VERSION |
106 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 96 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
107 | #else | 97 | #else |
108 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 98 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
109 | #endif | 99 | #endif |
110 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 100 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
111 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 101 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
112 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 102 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
113 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 103 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
114 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 104 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
115 | 105 | ||
116 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 106 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
117 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); | 107 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); |
118 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); | 108 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); |
119 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 109 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
120 | addItemInt("AllDay Size",&mAllDaySize,28); | 110 | addItemInt("AllDay Size",&mAllDaySize,28); |
121 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 111 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
122 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 112 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
123 | 113 | ||
124 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 114 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
125 | addItemStringList("EventSummary User",&mEventSummaryUser); | 115 | addItemStringList("EventSummary User",&mEventSummaryUser); |
126 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 116 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
127 | 117 | ||
128 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 118 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
129 | addItemBool("Enable Project View",&mEnableProjectView,false); | 119 | addItemBool("Enable Project View",&mEnableProjectView,false); |
130 | addItemBool("Auto Save",&mAutoSave,false); | 120 | addItemBool("Auto Save",&mAutoSave,false); |
131 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 121 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
132 | addItemBool("Confirm Deletes",&mConfirm,true); | 122 | addItemBool("Confirm Deletes",&mConfirm,true); |
133 | addItemString("Archive File",&mArchiveFile); | 123 | addItemString("Archive File",&mArchiveFile); |
134 | addItemString("Html Export File",&mHtmlExportFile, | 124 | addItemString("Html Export File",&mHtmlExportFile, |
135 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 125 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
136 | addItemBool("Html With Save",&mHtmlWithSave,false); | 126 | addItemBool("Html With Save",&mHtmlWithSave,false); |
137 | 127 | ||
138 | KPrefs::setCurrentGroup("Personal Settings"); | 128 | KPrefs::setCurrentGroup("Personal Settings"); |
139 | 129 | ||
140 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 130 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
141 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 131 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
142 | addItemBool("Bcc",&mBcc,false); | 132 | addItemBool("Bcc",&mBcc,false); |
143 | 133 | ||
144 | KPrefs::setCurrentGroup("Time & Date"); | 134 | KPrefs::setCurrentGroup("Time & Date"); |
145 | 135 | ||
146 | 136 | ||
147 | addItemInt("Default Start Time",&mStartTime,10); | 137 | addItemInt("Default Start Time",&mStartTime,10); |
148 | addItemInt("Default Duration",&mDefaultDuration,2); | 138 | addItemInt("Default Duration",&mDefaultDuration,2); |
149 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 139 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
150 | KPrefs::setCurrentGroup("AlarmSettings"); | 140 | KPrefs::setCurrentGroup("AlarmSettings"); |
151 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 141 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
152 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 142 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
153 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 143 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
154 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 144 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
155 | 145 | ||
156 | 146 | ||
157 | KPrefs::setCurrentGroup("Calendar"); | 147 | KPrefs::setCurrentGroup("Calendar"); |
158 | 148 | ||
159 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 149 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
160 | 150 | ||
161 | KPrefs::setCurrentGroup("Fonts"); | 151 | KPrefs::setCurrentGroup("Fonts"); |
162 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 152 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
163 | addItemFont("TimeBar Font",&mTimeBarFont,KGlobalSettings::generalFont() ); | 153 | addItemFont("TimeBar Font",&mTimeBarFont,KGlobalSettings::generalFont() ); |
164 | addItemFont("MonthView Font",&mMonthViewFont,KGlobalSettings::generalFont()); | 154 | addItemFont("MonthView Font",&mMonthViewFont,KGlobalSettings::generalFont()); |
165 | addItemFont("AgendaView Font",&mAgendaViewFont,KGlobalSettings::generalFont()); | 155 | addItemFont("AgendaView Font",&mAgendaViewFont,KGlobalSettings::generalFont()); |
166 | addItemFont("MarcusBains Font",&mMarcusBainsFont,KGlobalSettings::generalFont()); | 156 | addItemFont("MarcusBains Font",&mMarcusBainsFont,KGlobalSettings::generalFont()); |
167 | addItemFont("TimeLabels Font",&mTimeLabelsFont,KGlobalSettings::generalFont()); | 157 | addItemFont("TimeLabels Font",&mTimeLabelsFont,KGlobalSettings::generalFont()); |
168 | addItemFont("TodoView Font",&mTodoViewFont,KGlobalSettings::generalFont()); | 158 | addItemFont("TodoView Font",&mTodoViewFont,KGlobalSettings::generalFont()); |
169 | addItemFont("ListView Font",&mListViewFont,KGlobalSettings::generalFont()); | 159 | addItemFont("ListView Font",&mListViewFont,KGlobalSettings::generalFont()); |
170 | addItemFont("DateNavigator Font",&mDateNavigatorFont,KGlobalSettings::generalFont()); | 160 | addItemFont("DateNavigator Font",&mDateNavigatorFont,KGlobalSettings::generalFont()); |
171 | addItemFont("EditBox Font",&mEditBoxFont,KGlobalSettings::generalFont()); | 161 | addItemFont("EditBox Font",&mEditBoxFont,KGlobalSettings::generalFont()); |
172 | addItemFont("JournalView Font",&mJornalViewFont,KGlobalSettings::generalFont()); | 162 | addItemFont("JournalView Font",&mJornalViewFont,KGlobalSettings::generalFont()); |
173 | addItemFont("WhatsNextView Font",&mWhatsNextFont,KGlobalSettings::generalFont()); | 163 | addItemFont("WhatsNextView Font",&mWhatsNextFont,KGlobalSettings::generalFont()); |
174 | addItemFont("EventView Font",&mEventViewFont,KGlobalSettings::generalFont()); | 164 | addItemFont("EventView Font",&mEventViewFont,KGlobalSettings::generalFont()); |
175 | 165 | ||
176 | KPrefs::setCurrentGroup("RemoteSyncing"); | 166 | KPrefs::setCurrentGroup("RemoteSyncing"); |
177 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 167 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
178 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 168 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
179 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 169 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
180 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 170 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
181 | 171 | ||
182 | #ifdef _WIN32_ | 172 | #ifdef _WIN32_ |
183 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 173 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
184 | #else | 174 | #else |
185 | QString hdp= locateLocal("data","korganizer")+"/"; | 175 | QString hdp= locateLocal("data","korganizer")+"/"; |
186 | #endif | 176 | #endif |
187 | 177 | ||
188 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 178 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
189 | 179 | ||
190 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 180 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
191 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 181 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
192 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 182 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
193 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 183 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
194 | 184 | ||
195 | 185 | ||
196 | KPrefs::setCurrentGroup("Locale"); | 186 | KPrefs::setCurrentGroup("Locale"); |
197 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 187 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
198 | 188 | ||
199 | 189 | ||
200 | KPrefs::setCurrentGroup("Colors"); | 190 | KPrefs::setCurrentGroup("Colors"); |
201 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 191 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
202 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 192 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
203 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 193 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
204 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); | 194 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); |
205 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 195 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
206 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 196 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
207 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 197 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
208 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 198 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
209 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 199 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
210 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 200 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
211 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 201 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
212 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 202 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
213 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 203 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
214 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); | 204 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); |
215 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 205 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
216 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 206 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
217 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 207 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
218 | addItemBool("UseAppColors",&mUseAppColors,false); | 208 | addItemBool("UseAppColors",&mUseAppColors,false); |
219 | 209 | ||
220 | 210 | ||
221 | 211 | ||
222 | KPrefs::setCurrentGroup("Views"); | 212 | KPrefs::setCurrentGroup("Views"); |
223 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); | 213 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); |
224 | addItemInt("Hour Size",&mHourSize,8); | 214 | addItemInt("Hour Size",&mHourSize,8); |
225 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 215 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
226 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 216 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
227 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 217 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
228 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 218 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
229 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 219 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
230 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 220 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
231 | #ifdef DESKTOP_VERION | 221 | #ifdef DESKTOP_VERION |
232 | addItemBool("Enable ToolTips",&mEnableToolTips,true); | 222 | addItemBool("Enable ToolTips",&mEnableToolTips,true); |
233 | #else | 223 | #else |
234 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 224 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
235 | #endif | 225 | #endif |
236 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 226 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
237 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 227 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
238 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 228 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
239 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 229 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
240 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); | 230 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); |
241 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 231 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
242 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 232 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
243 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 233 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
244 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 234 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
245 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; | 235 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; |
246 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); | 236 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); |
247 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 237 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
248 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 238 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
249 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 239 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
250 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 240 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
251 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 241 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
252 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); | 242 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); |
253 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); | 243 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); |
254 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 244 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
255 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 245 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
256 | #ifdef DESKTOP_VERSION | 246 | #ifdef DESKTOP_VERSION |
257 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 247 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
258 | #else | 248 | #else |
259 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 249 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
260 | #endif | 250 | #endif |
261 | addItemInt("Day Begins",&mDayBegins,7); | 251 | addItemInt("Day Begins",&mDayBegins,7); |
262 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 252 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
263 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 253 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
264 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 254 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
265 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 255 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
266 | 256 | ||
267 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 257 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
268 | addItemBool("Full View Month",&mFullViewMonth,true); | 258 | addItemBool("Full View Month",&mFullViewMonth,true); |
269 | addItemBool("Full View Todo",&mFullViewTodo,true); | 259 | addItemBool("Full View Todo",&mFullViewTodo,true); |
270 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 260 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
271 | 261 | ||
272 | addItemInt("Next X Days",&mNextXDays,3); | 262 | addItemInt("Next X Days",&mNextXDays,3); |
273 | 263 | ||
274 | KPrefs::setCurrentGroup("Printer"); | 264 | KPrefs::setCurrentGroup("Printer"); |
275 | 265 | ||
276 | KPrefs::setCurrentGroup("Layout"); | 266 | KPrefs::setCurrentGroup("Layout"); |
277 | 267 | ||
278 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 268 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
279 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 269 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
280 | 270 | ||
281 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 271 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
282 | 272 | ||
283 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 273 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
284 | 274 | ||
285 | KPrefs::setCurrentGroup("Group Scheduling"); | 275 | KPrefs::setCurrentGroup("Group Scheduling"); |
286 | 276 | ||
287 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 277 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
288 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 278 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
289 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 279 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
290 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 280 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
291 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 281 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
292 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 282 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
293 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 283 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
294 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 284 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
295 | 285 | ||
296 | KPrefs::setCurrentGroup( "Editors" ); | 286 | KPrefs::setCurrentGroup( "Editors" ); |
297 | 287 | ||
298 | addItemStringList( "EventTemplates", &mEventTemplates ); | 288 | addItemStringList( "EventTemplates", &mEventTemplates ); |
299 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 289 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
300 | 290 | ||
301 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 291 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
302 | 292 | ||
303 | 293 | ||
304 | 294 | ||
305 | } | 295 | } |
306 | 296 | ||
307 | 297 | ||
308 | KOPrefs::~KOPrefs() | 298 | KOPrefs::~KOPrefs() |
309 | { | 299 | { |
310 | if (mInstance == this) | 300 | if (mInstance == this) |
311 | mInstance = insd.setObject(0); | 301 | mInstance = insd.setObject(0); |
312 | 302 | ||
313 | //qDebug("KOPrefs::~KOPrefs() "); | 303 | //qDebug("KOPrefs::~KOPrefs() "); |
314 | } | 304 | } |
315 | 305 | ||
316 | 306 | ||
317 | KOPrefs *KOPrefs::instance() | 307 | KOPrefs *KOPrefs::instance() |
318 | { | 308 | { |
319 | if (!mInstance) { | 309 | if (!mInstance) { |
320 | mInstance = insd.setObject(new KOPrefs()); | 310 | mInstance = insd.setObject(new KOPrefs()); |
321 | mInstance->readConfig(); | 311 | mInstance->readConfig(); |
322 | } | 312 | } |
323 | 313 | ||
324 | return mInstance; | 314 | return mInstance; |
325 | } | 315 | } |
326 | 316 | ||
327 | void KOPrefs::usrSetDefaults() | 317 | void KOPrefs::usrSetDefaults() |
328 | { | 318 | { |
329 | 319 | ||
330 | } | 320 | } |
331 | 321 | ||
332 | void KOPrefs::fillMailDefaults() | 322 | void KOPrefs::fillMailDefaults() |
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp index a9924ba..1024796 100644 --- a/microkde/kdatetbl.cpp +++ b/microkde/kdatetbl.cpp | |||
@@ -204,512 +204,514 @@ KDateTable::paintCell(QPainter *painter, int row, int col) | |||
204 | } | 204 | } |
205 | */ | 205 | */ |
206 | } | 206 | } |
207 | 207 | ||
208 | void | 208 | void |
209 | KDateTable::keyPressEvent( QKeyEvent *e ) | 209 | KDateTable::keyPressEvent( QKeyEvent *e ) |
210 | { | 210 | { |
211 | /* | 211 | /* |
212 | // not working properly | 212 | // not working properly |
213 | if ( e->key() == Qt::Key_Prior ) { | 213 | if ( e->key() == Qt::Key_Prior ) { |
214 | if ( date.month() == 1 ) { | 214 | if ( date.month() == 1 ) { |
215 | KNotifyClient::beep(); | 215 | KNotifyClient::beep(); |
216 | return; | 216 | return; |
217 | } | 217 | } |
218 | int day = date.day(); | 218 | int day = date.day(); |
219 | if ( day > 27 ) | 219 | if ( day > 27 ) |
220 | while ( !QDate::isValid( date.year(), date.month()-1, day ) ) | 220 | while ( !QDate::isValid( date.year(), date.month()-1, day ) ) |
221 | day--; | 221 | day--; |
222 | setDate(QDate(date.year(), date.month()-1, day)); | 222 | setDate(QDate(date.year(), date.month()-1, day)); |
223 | return; | 223 | return; |
224 | } | 224 | } |
225 | if ( e->key() == Qt::Key_Next ) { | 225 | if ( e->key() == Qt::Key_Next ) { |
226 | if ( date.month() == 12 ) { | 226 | if ( date.month() == 12 ) { |
227 | KNotifyClient::beep(); | 227 | KNotifyClient::beep(); |
228 | return; | 228 | return; |
229 | } | 229 | } |
230 | int day = date.day(); | 230 | int day = date.day(); |
231 | if ( day > 27 ) | 231 | if ( day > 27 ) |
232 | while ( !QDate::isValid( date.year(), date.month()+1, day ) ) | 232 | while ( !QDate::isValid( date.year(), date.month()+1, day ) ) |
233 | day--; | 233 | day--; |
234 | setDate(QDate(date.year(), date.month()+1, day)); | 234 | setDate(QDate(date.year(), date.month()+1, day)); |
235 | return; | 235 | return; |
236 | } | 236 | } |
237 | */ | 237 | */ |
238 | int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0; | 238 | int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0; |
239 | 239 | ||
240 | int temp=firstday+date.day()-dayoff; | 240 | int temp=firstday+date.day()-dayoff; |
241 | int pos = temp; | 241 | int pos = temp; |
242 | bool irgnore = true; | 242 | bool irgnore = true; |
243 | if ( e->state() != Qt::ControlButton ) { | 243 | if ( e->state() != Qt::ControlButton ) { |
244 | if ( e->key() == Qt::Key_Up ) { | 244 | if ( e->key() == Qt::Key_Up ) { |
245 | pos -= 7; | 245 | pos -= 7; |
246 | irgnore = false; | 246 | irgnore = false; |
247 | } | 247 | } |
248 | if ( e->key() == Qt::Key_Down ) { | 248 | if ( e->key() == Qt::Key_Down ) { |
249 | pos += 7; | 249 | pos += 7; |
250 | irgnore = false; | 250 | irgnore = false; |
251 | } | 251 | } |
252 | if ( e->key() == Qt::Key_Left ) { | 252 | if ( e->key() == Qt::Key_Left ) { |
253 | pos--; | 253 | pos--; |
254 | irgnore = false; | 254 | irgnore = false; |
255 | } | 255 | } |
256 | if ( e->key() == Qt::Key_Right ) { | 256 | if ( e->key() == Qt::Key_Right ) { |
257 | pos++; | 257 | pos++; |
258 | irgnore = false; | 258 | irgnore = false; |
259 | } | 259 | } |
260 | } | 260 | } |
261 | if ( irgnore ) | 261 | if ( irgnore ) |
262 | e->ignore(); | 262 | e->ignore(); |
263 | 263 | ||
264 | if(pos+dayoff<=firstday) | 264 | if(pos+dayoff<=firstday) |
265 | { // this day is in the previous month | 265 | { // this day is in the previous month |
266 | KNotifyClient::beep(); | 266 | KNotifyClient::beep(); |
267 | return; | 267 | return; |
268 | } | 268 | } |
269 | if(firstday+numdays<pos+dayoff) | 269 | if(firstday+numdays<pos+dayoff) |
270 | { // this date is in the next month | 270 | { // this date is in the next month |
271 | KNotifyClient::beep(i18n( "Month not long enough" )); | 271 | KNotifyClient::beep(i18n( "Month not long enough" )); |
272 | return; | 272 | return; |
273 | } | 273 | } |
274 | 274 | ||
275 | if ( pos == temp ) | 275 | if ( pos == temp ) |
276 | return; | 276 | return; |
277 | 277 | ||
278 | setDate(QDate(date.year(), date.month(), pos-firstday+dayoff)); | 278 | setDate(QDate(date.year(), date.month(), pos-firstday+dayoff)); |
279 | updateCell(temp/7+1, temp%7); // Update the previously selected cell | 279 | updateCell(temp/7+1, temp%7); // Update the previously selected cell |
280 | updateCell(pos/7+1, pos%7); // Update the selected cell | 280 | updateCell(pos/7+1, pos%7); // Update the selected cell |
281 | assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid()); | 281 | assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid()); |
282 | 282 | ||
283 | 283 | ||
284 | } | 284 | } |
285 | 285 | ||
286 | void | 286 | void |
287 | KDateTable::viewportResizeEvent(QResizeEvent * e) | 287 | KDateTable::viewportResizeEvent(QResizeEvent * e) |
288 | { | 288 | { |
289 | QGridView::viewportResizeEvent(e); | 289 | QGridView::viewportResizeEvent(e); |
290 | 290 | ||
291 | setCellWidth(viewport()->width()/7); | 291 | setCellWidth(viewport()->width()/7); |
292 | setCellHeight(viewport()->height()/7); | 292 | setCellHeight(viewport()->height()/7); |
293 | } | 293 | } |
294 | 294 | ||
295 | void | 295 | void |
296 | KDateTable::setFontSize(int size) | 296 | KDateTable::setFontSize(int size) |
297 | { | 297 | { |
298 | int count; | 298 | int count; |
299 | QRect rect; | 299 | QRect rect; |
300 | // ----- store rectangles: | 300 | // ----- store rectangles: |
301 | fontsize=size; | 301 | fontsize=size; |
302 | QFont _font = font(); | 302 | QFont _font = font(); |
303 | _font.setPointSize(fontsize); | 303 | _font.setPointSize(fontsize); |
304 | setFont( _font ); | 304 | setFont( _font ); |
305 | _font.setBold( true ); | 305 | _font.setBold( true ); |
306 | QFontMetrics metrics(_font); | 306 | QFontMetrics metrics(_font); |
307 | 307 | ||
308 | // ----- find largest day name: | 308 | // ----- find largest day name: |
309 | maxCell.setWidth(0); | 309 | maxCell.setWidth(0); |
310 | maxCell.setHeight(0); | 310 | maxCell.setHeight(0); |
311 | for(count=0; count<7; ++count) | 311 | for(count=0; count<7; ++count) |
312 | { | 312 | { |
313 | rect=metrics.boundingRect(KGlobal::locale()->weekDayName(count+1, true)); | 313 | rect=metrics.boundingRect(KGlobal::locale()->weekDayName(count+1, true)); |
314 | maxCell.setWidth(QMAX(maxCell.width(), rect.width())); | 314 | maxCell.setWidth(QMAX(maxCell.width(), rect.width())); |
315 | maxCell.setHeight(QMAX(maxCell.height(), rect.height())); | 315 | maxCell.setHeight(QMAX(maxCell.height(), rect.height())); |
316 | } | 316 | } |
317 | // ----- compare with a real wide number and add some space: | 317 | // ----- compare with a real wide number and add some space: |
318 | rect=metrics.boundingRect(QString::fromLatin1("88")); | 318 | rect=metrics.boundingRect(QString::fromLatin1("88")); |
319 | maxCell.setWidth(QMAX(maxCell.width()+2, rect.width())); | 319 | maxCell.setWidth(QMAX(maxCell.width()+2, rect.width())); |
320 | #ifdef DESKTOP_VERSION | 320 | #ifdef DESKTOP_VERSION |
321 | maxCell.setHeight(QMAX(maxCell.height()+8, rect.height())); | 321 | maxCell.setHeight(QMAX(maxCell.height()+8, rect.height())); |
322 | #else | 322 | #else |
323 | maxCell.setHeight(QMAX(maxCell.height()+4, rect.height())); | 323 | maxCell.setHeight(QMAX(maxCell.height()+4, rect.height())); |
324 | #endif | 324 | #endif |
325 | if ( maxCell.width() * 1000 / maxCell.height() > 1900 ) { | 325 | if ( maxCell.width() * 1000 / maxCell.height() > 1900 ) { |
326 | maxCell.setHeight(maxCell.width() * 1000 / 1900 ); | 326 | maxCell.setHeight(maxCell.width() * 1000 / 1900 ); |
327 | qDebug("setmax "); | 327 | qDebug("setmax "); |
328 | } | 328 | } |
329 | } | 329 | } |
330 | 330 | ||
331 | void | 331 | void |
332 | KDateTable::contentsMousePressEvent(QMouseEvent *e) | 332 | KDateTable::contentsMousePressEvent(QMouseEvent *e) |
333 | { | 333 | { |
334 | if(e->type()!=QEvent::MouseButtonPress) | 334 | if(e->type()!=QEvent::MouseButtonPress) |
335 | { // the KDatePicker only reacts on mouse press events: | 335 | { // the KDatePicker only reacts on mouse press events: |
336 | return; | 336 | return; |
337 | } | 337 | } |
338 | if(!isEnabled()) | 338 | if(!isEnabled()) |
339 | { | 339 | { |
340 | KNotifyClient::beep(); | 340 | KNotifyClient::beep(); |
341 | return; | 341 | return; |
342 | } | 342 | } |
343 | 343 | ||
344 | int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0; | 344 | int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0; |
345 | // ----- | 345 | // ----- |
346 | int row, col, pos, temp; | 346 | int row, col, pos, temp; |
347 | QPoint mouseCoord; | 347 | QPoint mouseCoord; |
348 | // ----- | 348 | // ----- |
349 | mouseCoord = e->pos(); | 349 | mouseCoord = e->pos(); |
350 | row=rowAt(mouseCoord.y()); | 350 | row=rowAt(mouseCoord.y()); |
351 | col=columnAt(mouseCoord.x()); | 351 | col=columnAt(mouseCoord.x()); |
352 | if(row<0 || col<0) | 352 | if(row<0 || col<0) |
353 | { // the user clicked on the frame of the table | 353 | { // the user clicked on the frame of the table |
354 | return; | 354 | return; |
355 | } | 355 | } |
356 | pos=7*(row-1)+col+1; | 356 | pos=7*(row-1)+col+1; |
357 | #if 0 | 357 | #if 0 |
358 | if(pos+dayoff<=firstday) | 358 | if(pos+dayoff<=firstday) |
359 | { // this day is in the previous month | 359 | { // this day is in the previous month |
360 | KNotifyClient::beep(); | 360 | KNotifyClient::beep(); |
361 | return; | 361 | return; |
362 | } | 362 | } |
363 | if(firstday+numdays<pos+dayoff) | 363 | if(firstday+numdays<pos+dayoff) |
364 | { // this date is in the next month | 364 | { // this date is in the next month |
365 | KNotifyClient::beep(); | 365 | KNotifyClient::beep(); |
366 | return; | 366 | return; |
367 | } | 367 | } |
368 | #endif | 368 | #endif |
369 | temp=firstday+date.day()-dayoff-1; | 369 | temp=firstday+date.day()-dayoff-1; |
370 | QDate da = QDate(date.year(), date.month(),1); | 370 | QDate da = QDate(date.year(), date.month(),1); |
371 | setDate(da.addDays( pos-firstday+dayoff-1)); | 371 | setDate(da.addDays( pos-firstday+dayoff-1)); |
372 | updateCell(temp/7+1, temp%7); // Update the previously selected cell | 372 | updateCell(temp/7+1, temp%7); // Update the previously selected cell |
373 | updateCell(row, col); // Update the selected cell | 373 | updateCell(row, col); // Update the selected cell |
374 | // assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid()); | 374 | // assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid()); |
375 | emit(tableClicked()); | 375 | emit(tableClicked()); |
376 | } | 376 | } |
377 | 377 | ||
378 | bool | 378 | bool |
379 | KDateTable::setDate(const QDate& date_) | 379 | KDateTable::setDate(const QDate& date_) |
380 | { | 380 | { |
381 | bool changed=false; | 381 | bool changed=false; |
382 | QDate temp; | 382 | QDate temp; |
383 | mMarkCurrent = false; | 383 | mMarkCurrent = false; |
384 | // ----- | 384 | // ----- |
385 | if(!date_.isValid()) | 385 | if(!date_.isValid()) |
386 | { | 386 | { |
387 | kdDebug() << "KDateTable::setDate: refusing to set invalid date." << endl; | 387 | kdDebug() << "KDateTable::setDate: refusing to set invalid date." << endl; |
388 | return false; | 388 | return false; |
389 | } | 389 | } |
390 | if(date!=date_) | 390 | if(date!=date_) |
391 | { | 391 | { |
392 | date=date_; | 392 | date=date_; |
393 | changed=true; | 393 | changed=true; |
394 | } | 394 | } |
395 | mMarkCurrent = ( date.month() == QDate::currentDate().month() && date.year() == QDate::currentDate().year() ); | 395 | mMarkCurrent = ( date.month() == QDate::currentDate().month() && date.year() == QDate::currentDate().year() ); |
396 | temp.setYMD(date.year(), date.month(), 1); | 396 | temp.setYMD(date.year(), date.month(), 1); |
397 | firstday=temp.dayOfWeek(); | 397 | firstday=temp.dayOfWeek(); |
398 | if(firstday==1) firstday=8; | 398 | if(firstday==1) firstday=8; |
399 | numdays=date.daysInMonth(); | 399 | numdays=date.daysInMonth(); |
400 | if(date.month()==1) | 400 | if(date.month()==1) |
401 | { // set to december of previous year | 401 | { // set to december of previous year |
402 | temp.setYMD(date.year()-1, 12, 1); | 402 | temp.setYMD(date.year()-1, 12, 1); |
403 | } else { // set to previous month | 403 | } else { // set to previous month |
404 | temp.setYMD(date.year(), date.month()-1, 1); | 404 | temp.setYMD(date.year(), date.month()-1, 1); |
405 | } | 405 | } |
406 | numDaysPrevMonth=temp.daysInMonth(); | 406 | numDaysPrevMonth=temp.daysInMonth(); |
407 | if(changed) | 407 | if(changed) |
408 | { | 408 | { |
409 | repaintContents(false); | 409 | repaintContents(false); |
410 | } | 410 | } |
411 | emit(dateChanged(date)); | 411 | emit(dateChanged(date)); |
412 | return true; | 412 | return true; |
413 | } | 413 | } |
414 | 414 | ||
415 | const QDate& | 415 | const QDate& |
416 | KDateTable::getDate() const | 416 | KDateTable::getDate() const |
417 | { | 417 | { |
418 | return date; | 418 | return date; |
419 | } | 419 | } |
420 | 420 | ||
421 | void KDateTable::focusInEvent( QFocusEvent *e ) | 421 | void KDateTable::focusInEvent( QFocusEvent *e ) |
422 | { | 422 | { |
423 | repaintContents(false); | 423 | repaintContents(false); |
424 | QGridView::focusInEvent( e ); | 424 | QGridView::focusInEvent( e ); |
425 | } | 425 | } |
426 | 426 | ||
427 | void KDateTable::focusOutEvent( QFocusEvent *e ) | 427 | void KDateTable::focusOutEvent( QFocusEvent *e ) |
428 | { | 428 | { |
429 | repaintContents(false); | 429 | repaintContents(false); |
430 | QGridView::focusOutEvent( e ); | 430 | QGridView::focusOutEvent( e ); |
431 | } | 431 | } |
432 | 432 | ||
433 | QSize | 433 | QSize |
434 | KDateTable::sizeHint() const | 434 | KDateTable::sizeHint() const |
435 | { | 435 | { |
436 | if(maxCell.height()>0 && maxCell.width()>0) | 436 | if(maxCell.height()>0 && maxCell.width()>0) |
437 | { | 437 | { |
438 | return QSize((maxCell.width()+2)*numCols()+2*frameWidth(), | 438 | return QSize((maxCell.width()+2)*numCols()+2*frameWidth(), |
439 | (maxCell.height()+4)*numRows()+2*frameWidth()); | 439 | (maxCell.height()+4)*numRows()+2*frameWidth()); |
440 | } else { | 440 | } else { |
441 | return QSize(-1, -1); | 441 | return QSize(-1, -1); |
442 | } | 442 | } |
443 | } | 443 | } |
444 | 444 | ||
445 | KDateInternalMonthPicker::KDateInternalMonthPicker | 445 | KDateInternalMonthPicker::KDateInternalMonthPicker |
446 | (QWidget* parent, const char* name) | 446 | (QWidget* parent, const char* name) |
447 | : QGridView(parent, name), | 447 | : QGridView(parent, name), |
448 | result(0) // invalid | 448 | result(0) // invalid |
449 | { | 449 | { |
450 | QRect rect; | 450 | QRect rect; |
451 | QFont font; | 451 | QFont font; |
452 | // ----- | 452 | // ----- |
453 | activeCol = -1; | 453 | activeCol = -1; |
454 | activeRow = -1; | 454 | activeRow = -1; |
455 | font=KGlobalSettings::generalFont(); | 455 | font=KGlobalSettings::generalFont(); |
456 | int fontsize = 10; | 456 | int fontsize = 10; |
457 | int add = 2; | 457 | int add = 2; |
458 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 458 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
459 | add += 8; | 459 | add += 8; |
460 | if ( QApplication::desktop()->width() > 640 ) | ||
461 | add += 4; | ||
460 | font.setPointSize(fontsize+add); | 462 | font.setPointSize(fontsize+add); |
461 | setFont(font); | 463 | setFont(font); |
462 | setHScrollBarMode(AlwaysOff); | 464 | setHScrollBarMode(AlwaysOff); |
463 | setVScrollBarMode(AlwaysOff); | 465 | setVScrollBarMode(AlwaysOff); |
464 | setFrameStyle(QFrame::NoFrame); | 466 | setFrameStyle(QFrame::NoFrame); |
465 | setNumRows(4); | 467 | setNumRows(4); |
466 | setNumCols(3); | 468 | setNumCols(3); |
467 | // enable to find drawing failures: | 469 | // enable to find drawing failures: |
468 | // setTableFlags(Tbl_clipCellPainting); | 470 | // setTableFlags(Tbl_clipCellPainting); |
469 | #if 0 | 471 | #if 0 |
470 | viewport()->setEraseColor(lightGray); // for consistency with the datepicker | 472 | viewport()->setEraseColor(lightGray); // for consistency with the datepicker |
471 | #endif | 473 | #endif |
472 | // ----- find the preferred size | 474 | // ----- find the preferred size |
473 | // (this is slow, possibly, but unfortunatly it is needed here): | 475 | // (this is slow, possibly, but unfortunatly it is needed here): |
474 | QFontMetrics metrics(font); | 476 | QFontMetrics metrics(font); |
475 | for(int i=1; i <= 12; ++i) | 477 | for(int i=1; i <= 12; ++i) |
476 | { | 478 | { |
477 | rect=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); | 479 | rect=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); |
478 | if(max.width()<rect.width()) max.setWidth(rect.width()); | 480 | if(max.width()<rect.width()) max.setWidth(rect.width()); |
479 | if(max.height()<rect.height()) max.setHeight(rect.height()); | 481 | if(max.height()<rect.height()) max.setHeight(rect.height()); |
480 | } | 482 | } |
481 | 483 | ||
482 | } | 484 | } |
483 | 485 | ||
484 | QSize | 486 | QSize |
485 | KDateInternalMonthPicker::sizeHint() const | 487 | KDateInternalMonthPicker::sizeHint() const |
486 | { | 488 | { |
487 | return QSize((max.width()+6)*numCols()+2*frameWidth(), | 489 | return QSize((max.width()+6)*numCols()+2*frameWidth(), |
488 | (max.height()+6)*numRows()+2*frameWidth()); | 490 | (max.height()+6)*numRows()+2*frameWidth()); |
489 | } | 491 | } |
490 | 492 | ||
491 | int | 493 | int |
492 | KDateInternalMonthPicker::getResult() const | 494 | KDateInternalMonthPicker::getResult() const |
493 | { | 495 | { |
494 | return result; | 496 | return result; |
495 | } | 497 | } |
496 | 498 | ||
497 | void | 499 | void |
498 | KDateInternalMonthPicker::setupPainter(QPainter *p) | 500 | KDateInternalMonthPicker::setupPainter(QPainter *p) |
499 | { | 501 | { |
500 | p->setPen(black); | 502 | p->setPen(black); |
501 | } | 503 | } |
502 | 504 | ||
503 | void | 505 | void |
504 | KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*) | 506 | KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*) |
505 | { | 507 | { |
506 | setCellWidth(width()/3); | 508 | setCellWidth(width()/3); |
507 | setCellHeight(height()/4); | 509 | setCellHeight(height()/4); |
508 | } | 510 | } |
509 | 511 | ||
510 | void | 512 | void |
511 | KDateInternalMonthPicker::paintCell(QPainter* painter, int row, int col) | 513 | KDateInternalMonthPicker::paintCell(QPainter* painter, int row, int col) |
512 | { | 514 | { |
513 | int index; | 515 | int index; |
514 | QString text; | 516 | QString text; |
515 | // ----- find the number of the cell: | 517 | // ----- find the number of the cell: |
516 | index=3*row+col+1; | 518 | index=3*row+col+1; |
517 | text=KGlobal::locale()->monthName(index, false); | 519 | text=KGlobal::locale()->monthName(index, false); |
518 | painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); | 520 | painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); |
519 | if ( activeCol == col && activeRow == row ) | 521 | if ( activeCol == col && activeRow == row ) |
520 | painter->drawRect( 0, 0, cellWidth(), cellHeight() ); | 522 | painter->drawRect( 0, 0, cellWidth(), cellHeight() ); |
521 | } | 523 | } |
522 | 524 | ||
523 | void | 525 | void |
524 | KDateInternalMonthPicker::contentsMousePressEvent(QMouseEvent *e) | 526 | KDateInternalMonthPicker::contentsMousePressEvent(QMouseEvent *e) |
525 | { | 527 | { |
526 | if(!isEnabled() || e->button() != LeftButton) | 528 | if(!isEnabled() || e->button() != LeftButton) |
527 | { | 529 | { |
528 | KNotifyClient::beep(); | 530 | KNotifyClient::beep(); |
529 | return; | 531 | return; |
530 | } | 532 | } |
531 | // ----- | 533 | // ----- |
532 | int row, col; | 534 | int row, col; |
533 | QPoint mouseCoord; | 535 | QPoint mouseCoord; |
534 | // ----- | 536 | // ----- |
535 | mouseCoord = e->pos(); | 537 | mouseCoord = e->pos(); |
536 | row=rowAt(mouseCoord.y()); | 538 | row=rowAt(mouseCoord.y()); |
537 | col=columnAt(mouseCoord.x()); | 539 | col=columnAt(mouseCoord.x()); |
538 | 540 | ||
539 | if(row<0 || col<0) | 541 | if(row<0 || col<0) |
540 | { // the user clicked on the frame of the table | 542 | { // the user clicked on the frame of the table |
541 | activeCol = -1; | 543 | activeCol = -1; |
542 | activeRow = -1; | 544 | activeRow = -1; |
543 | } else { | 545 | } else { |
544 | activeCol = col; | 546 | activeCol = col; |
545 | activeRow = row; | 547 | activeRow = row; |
546 | updateCell( row, col /*, false */ ); | 548 | updateCell( row, col /*, false */ ); |
547 | } | 549 | } |
548 | } | 550 | } |
549 | 551 | ||
550 | void | 552 | void |
551 | KDateInternalMonthPicker::contentsMouseMoveEvent(QMouseEvent *e) | 553 | KDateInternalMonthPicker::contentsMouseMoveEvent(QMouseEvent *e) |
552 | { | 554 | { |
553 | if (e->state() & LeftButton) | 555 | if (e->state() & LeftButton) |
554 | { | 556 | { |
555 | int row, col; | 557 | int row, col; |
556 | QPoint mouseCoord; | 558 | QPoint mouseCoord; |
557 | // ----- | 559 | // ----- |
558 | mouseCoord = e->pos(); | 560 | mouseCoord = e->pos(); |
559 | row=rowAt(mouseCoord.y()); | 561 | row=rowAt(mouseCoord.y()); |
560 | col=columnAt(mouseCoord.x()); | 562 | col=columnAt(mouseCoord.x()); |
561 | int tmpRow = -1, tmpCol = -1; | 563 | int tmpRow = -1, tmpCol = -1; |
562 | if(row<0 || col<0) | 564 | if(row<0 || col<0) |
563 | { // the user clicked on the frame of the table | 565 | { // the user clicked on the frame of the table |
564 | if ( activeCol > -1 ) | 566 | if ( activeCol > -1 ) |
565 | { | 567 | { |
566 | tmpRow = activeRow; | 568 | tmpRow = activeRow; |
567 | tmpCol = activeCol; | 569 | tmpCol = activeCol; |
568 | } | 570 | } |
569 | activeCol = -1; | 571 | activeCol = -1; |
570 | activeRow = -1; | 572 | activeRow = -1; |
571 | } else { | 573 | } else { |
572 | bool differentCell = (activeRow != row || activeCol != col); | 574 | bool differentCell = (activeRow != row || activeCol != col); |
573 | if ( activeCol > -1 && differentCell) | 575 | if ( activeCol > -1 && differentCell) |
574 | { | 576 | { |
575 | tmpRow = activeRow; | 577 | tmpRow = activeRow; |
576 | tmpCol = activeCol; | 578 | tmpCol = activeCol; |
577 | } | 579 | } |
578 | if ( differentCell) | 580 | if ( differentCell) |
579 | { | 581 | { |
580 | activeRow = row; | 582 | activeRow = row; |
581 | activeCol = col; | 583 | activeCol = col; |
582 | updateCell( row, col /*, false */ ); // mark the new active cell | 584 | updateCell( row, col /*, false */ ); // mark the new active cell |
583 | } | 585 | } |
584 | } | 586 | } |
585 | if ( tmpRow > -1 ) // repaint the former active cell | 587 | if ( tmpRow > -1 ) // repaint the former active cell |
586 | updateCell( tmpRow, tmpCol /*, true */ ); | 588 | updateCell( tmpRow, tmpCol /*, true */ ); |
587 | } | 589 | } |
588 | } | 590 | } |
589 | 591 | ||
590 | void | 592 | void |
591 | KDateInternalMonthPicker::contentsMouseReleaseEvent(QMouseEvent *e) | 593 | KDateInternalMonthPicker::contentsMouseReleaseEvent(QMouseEvent *e) |
592 | { | 594 | { |
593 | if(!isEnabled()) | 595 | if(!isEnabled()) |
594 | { | 596 | { |
595 | return; | 597 | return; |
596 | } | 598 | } |
597 | // ----- | 599 | // ----- |
598 | int row, col, pos; | 600 | int row, col, pos; |
599 | QPoint mouseCoord; | 601 | QPoint mouseCoord; |
600 | // ----- | 602 | // ----- |
601 | mouseCoord = e->pos(); | 603 | mouseCoord = e->pos(); |
602 | row=rowAt(mouseCoord.y()); | 604 | row=rowAt(mouseCoord.y()); |
603 | col=columnAt(mouseCoord.x()); | 605 | col=columnAt(mouseCoord.x()); |
604 | if(row<0 || col<0) | 606 | if(row<0 || col<0) |
605 | { // the user clicked on the frame of the table | 607 | { // the user clicked on the frame of the table |
606 | emit(closeMe(0)); | 608 | emit(closeMe(0)); |
607 | } | 609 | } |
608 | pos=3*row+col+1; | 610 | pos=3*row+col+1; |
609 | result=pos; | 611 | result=pos; |
610 | emit(closeMe(1)); | 612 | emit(closeMe(1)); |
611 | } | 613 | } |
612 | 614 | ||
613 | 615 | ||
614 | 616 | ||
615 | KDateInternalYearSelector::KDateInternalYearSelector | 617 | KDateInternalYearSelector::KDateInternalYearSelector |
616 | (int fontsize, QWidget* parent, const char* name) | 618 | (int fontsize, QWidget* parent, const char* name) |
617 | : QLineEdit(parent, name), | 619 | : QLineEdit(parent, name), |
618 | val(new QIntValidator(this)), | 620 | val(new QIntValidator(this)), |
619 | result(0) | 621 | result(0) |
620 | { | 622 | { |
621 | QFont font; | 623 | QFont font; |
622 | // ----- | 624 | // ----- |
623 | font=KGlobalSettings::generalFont(); | 625 | font=KGlobalSettings::generalFont(); |
624 | font.setPointSize(fontsize); | 626 | font.setPointSize(fontsize); |
625 | setFont(font); | 627 | setFont(font); |
626 | #if 0 | 628 | #if 0 |
627 | setFrameStyle(QFrame::NoFrame); | 629 | setFrameStyle(QFrame::NoFrame); |
628 | #endif | 630 | #endif |
629 | // we have to respect the limits of QDate here, I fear: | 631 | // we have to respect the limits of QDate here, I fear: |
630 | val->setRange(0, 8000); | 632 | val->setRange(0, 8000); |
631 | setValidator(val); | 633 | setValidator(val); |
632 | connect(this, SIGNAL(returnPressed()), SLOT(yearEnteredSlot())); | 634 | connect(this, SIGNAL(returnPressed()), SLOT(yearEnteredSlot())); |
633 | } | 635 | } |
634 | 636 | ||
635 | void | 637 | void |
636 | KDateInternalYearSelector::yearEnteredSlot() | 638 | KDateInternalYearSelector::yearEnteredSlot() |
637 | { | 639 | { |
638 | bool ok; | 640 | bool ok; |
639 | int year; | 641 | int year; |
640 | QDate date; | 642 | QDate date; |
641 | // ----- check if this is a valid year: | 643 | // ----- check if this is a valid year: |
642 | year=text().toInt(&ok); | 644 | year=text().toInt(&ok); |
643 | if(!ok) | 645 | if(!ok) |
644 | { | 646 | { |
645 | KNotifyClient::beep(); | 647 | KNotifyClient::beep(); |
646 | return; | 648 | return; |
647 | } | 649 | } |
648 | date.setYMD(year, 1, 1); | 650 | date.setYMD(year, 1, 1); |
649 | if(!date.isValid()) | 651 | if(!date.isValid()) |
650 | { | 652 | { |
651 | KNotifyClient::beep(); | 653 | KNotifyClient::beep(); |
652 | return; | 654 | return; |
653 | } | 655 | } |
654 | result=year; | 656 | result=year; |
655 | emit(closeMe(1)); | 657 | emit(closeMe(1)); |
656 | } | 658 | } |
657 | 659 | ||
658 | int | 660 | int |
659 | KDateInternalYearSelector::getYear() | 661 | KDateInternalYearSelector::getYear() |
660 | { | 662 | { |
661 | return result; | 663 | return result; |
662 | } | 664 | } |
663 | 665 | ||
664 | void | 666 | void |
665 | KDateInternalYearSelector::setYear(int year) | 667 | KDateInternalYearSelector::setYear(int year) |
666 | { | 668 | { |
667 | QString temp; | 669 | QString temp; |
668 | // ----- | 670 | // ----- |
669 | temp.setNum(year); | 671 | temp.setNum(year); |
670 | setText(temp); | 672 | setText(temp); |
671 | } | 673 | } |
672 | 674 | ||
673 | KPopupFrame::KPopupFrame(QWidget* parent, const char* name) | 675 | KPopupFrame::KPopupFrame(QWidget* parent, const char* name) |
674 | : QFrame(parent, name, WType_Popup), | 676 | : QFrame(parent, name, WType_Popup), |
675 | result(0), // rejected | 677 | result(0), // rejected |
676 | main(0) | 678 | main(0) |
677 | { | 679 | { |
678 | setFrameStyle(QFrame::Box|QFrame::Raised); | 680 | setFrameStyle(QFrame::Box|QFrame::Raised); |
679 | setMidLineWidth(2); | 681 | setMidLineWidth(2); |
680 | } | 682 | } |
681 | 683 | ||
682 | void | 684 | void |
683 | KPopupFrame::keyPressEvent(QKeyEvent* e) | 685 | KPopupFrame::keyPressEvent(QKeyEvent* e) |
684 | { | 686 | { |
685 | if(e->key()==Key_Escape) | 687 | if(e->key()==Key_Escape) |
686 | { | 688 | { |
687 | result=0; // rejected | 689 | result=0; // rejected |
688 | qApp->exit_loop(); | 690 | qApp->exit_loop(); |
689 | } | 691 | } |
690 | } | 692 | } |
691 | 693 | ||
692 | void | 694 | void |
693 | KPopupFrame::close(int r) | 695 | KPopupFrame::close(int r) |
694 | { | 696 | { |
695 | result=r; | 697 | result=r; |
696 | qApp->exit_loop(); | 698 | qApp->exit_loop(); |
697 | } | 699 | } |
698 | 700 | ||
699 | void | 701 | void |
700 | KPopupFrame::setMainWidget(QWidget* m) | 702 | KPopupFrame::setMainWidget(QWidget* m) |
701 | { | 703 | { |
702 | main=m; | 704 | main=m; |
703 | if(main!=0) | 705 | if(main!=0) |
704 | { | 706 | { |
705 | resize(main->width()+2*frameWidth(), main->height()+2*frameWidth()); | 707 | resize(main->width()+2*frameWidth(), main->height()+2*frameWidth()); |
706 | } | 708 | } |
707 | } | 709 | } |
708 | 710 | ||
709 | void | 711 | void |
710 | KPopupFrame::resizeEvent(QResizeEvent*) | 712 | KPopupFrame::resizeEvent(QResizeEvent*) |
711 | { | 713 | { |
712 | if(main!=0) | 714 | if(main!=0) |
713 | { | 715 | { |
714 | main->setGeometry(frameWidth(), frameWidth(), | 716 | main->setGeometry(frameWidth(), frameWidth(), |
715 | width()-2*frameWidth(), height()-2*frameWidth()); | 717 | width()-2*frameWidth(), height()-2*frameWidth()); |