author | zautrix <zautrix> | 2005-02-05 15:04:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-05 15:04:59 (UTC) |
commit | c3342620087b5cda19d7c8d0adaa2c7b5b85e2c9 (patch) (unidiff) | |
tree | c78145cceb427ecd8a8ee6ad272f42a38bf8f284 | |
parent | 231a90376b096687770b2b029d4a3d2efa232b2e (diff) | |
download | kdepimpi-c3342620087b5cda19d7c8d0adaa2c7b5b85e2c9.zip kdepimpi-c3342620087b5cda19d7c8d0adaa2c7b5b85e2c9.tar.gz kdepimpi-c3342620087b5cda19d7c8d0adaa2c7b5b85e2c9.tar.bz2 |
compile fixes
-rw-r--r-- | desktop/rpm/kdepim_rpm | 2 | ||||
-rw-r--r-- | korganizer/journalentry.cpp | 1 | ||||
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 1 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 1 | ||||
-rw-r--r-- | version | 2 |
5 files changed, 5 insertions, 2 deletions
diff --git a/desktop/rpm/kdepim_rpm b/desktop/rpm/kdepim_rpm index b1bbed2..04c6aa1 100644 --- a/desktop/rpm/kdepim_rpm +++ b/desktop/rpm/kdepim_rpm | |||
@@ -1,84 +1,84 @@ | |||
1 | Summary: A collection of PIM programs | 1 | Summary: A collection of PIM programs |
2 | Name: KDE-Pim-Pi | 2 | Name: KDE-Pim-Pi |
3 | Version: 2.0.3 | 3 | Version: 2.0.4 |
4 | Release: SuSE_9.2 | 4 | Release: SuSE_9.2 |
5 | Copyright:GPL | 5 | Copyright:GPL |
6 | Group: Productivity/Pim | 6 | Group: Productivity/Pim |
7 | Source:http://sourceforge.net/projects/kdepimpi/ | 7 | Source:http://sourceforge.net/projects/kdepimpi/ |
8 | URL:http://sourceforge.net/projects/kdepimpi/ | 8 | URL:http://sourceforge.net/projects/kdepimpi/ |
9 | Packager: zautrix | 9 | Packager: zautrix |
10 | 10 | ||
11 | %description | 11 | %description |
12 | This package contains the platform-independent PIM programs from | 12 | This package contains the platform-independent PIM programs from |
13 | www.pi-sync.net, compiled for SuSE 9.2: | 13 | www.pi-sync.net, compiled for SuSE 9.2: |
14 | KTimeTacker/Pi | 14 | KTimeTacker/Pi |
15 | KPhone/Pi | 15 | KPhone/Pi |
16 | KAddressbook/Pi | 16 | KAddressbook/Pi |
17 | KOrganizer/Pi | 17 | KOrganizer/Pi |
18 | PasswordManager/Pi | 18 | PasswordManager/Pi |
19 | KOPieMail/Pi | 19 | KOPieMail/Pi |
20 | 20 | ||
21 | These applications do not need anything from the KDE-desktop | 21 | These applications do not need anything from the KDE-desktop |
22 | at all to run on Linux. However, there is a dependency from | 22 | at all to run on Linux. However, there is a dependency from |
23 | two KDE libs, because a small command line program is included | 23 | two KDE libs, because a small command line program is included |
24 | to make it possible to sync with the KDE-desktop applications. | 24 | to make it possible to sync with the KDE-desktop applications. |
25 | 25 | ||
26 | These applications are independent from the KDE-desktop | 26 | These applications are independent from the KDE-desktop |
27 | environment. That means, nothing of your existing | 27 | environment. That means, nothing of your existing |
28 | KDE-desktop setup will be changed, or any data | 28 | KDE-desktop setup will be changed, or any data |
29 | (calendar-addressbook) used by the KDE-desktop | 29 | (calendar-addressbook) used by the KDE-desktop |
30 | applications will be changed or accessed. | 30 | applications will be changed or accessed. |
31 | These applications stores their data and config in | 31 | These applications stores their data and config in |
32 | $HOME/kdepim/ | 32 | $HOME/kdepim/ |
33 | However, because the same file format is used, | 33 | However, because the same file format is used, |
34 | an easy exchange of data with the KDE-desktop | 34 | an easy exchange of data with the KDE-desktop |
35 | is possible. | 35 | is possible. |
36 | A small command line program is included | 36 | A small command line program is included |
37 | to make it possible to sync with the KDE-desktop applications. | 37 | to make it possible to sync with the KDE-desktop applications. |
38 | You do not need to call this program from the commandline, | 38 | You do not need to call this program from the commandline, |
39 | it is called from the KDE-Pim/Pi apps when you choose there: | 39 | it is called from the KDE-Pim/Pi apps when you choose there: |
40 | Sync with KDE_Desktop. | 40 | Sync with KDE_Desktop. |
41 | If something is going wrong, please start the | 41 | If something is going wrong, please start the |
42 | KDE-Pim/Pi program itself from the console to get detailed output. | 42 | KDE-Pim/Pi program itself from the console to get detailed output. |
43 | 43 | ||
44 | After installation, you should have a | 44 | After installation, you should have a |
45 | PIM-pi | 45 | PIM-pi |
46 | folder in your KDE start menu, where you can | 46 | folder in your KDE start menu, where you can |
47 | start the applications from. | 47 | start the applications from. |
48 | 48 | ||
49 | These programs makes it possible to sync your Zaurus easily | 49 | These programs makes it possible to sync your Zaurus easily |
50 | (with the KDE-Pim/Pi programs running on the Zaurus) | 50 | (with the KDE-Pim/Pi programs running on the Zaurus) |
51 | with the KDE-desktop calendar/addressbook data. | 51 | with the KDE-desktop calendar/addressbook data. |
52 | If you want to use that, you have to update your | 52 | If you want to use that, you have to update your |
53 | KDE-desktop to version 3.3.0 or higher. | 53 | KDE-desktop to version 3.3.0 or higher. |
54 | SuSE 9.2 contains KDE 3.3.0 such that no update is needed. | 54 | SuSE 9.2 contains KDE 3.3.0 such that no update is needed. |
55 | Actually - after the (non difficult) configuration is set up - | 55 | Actually - after the (non difficult) configuration is set up - |
56 | with two mouseklicks on the Zaurus, | 56 | with two mouseklicks on the Zaurus, |
57 | the Zaurus syncs with the corresponding KDE-Pim/Pi | 57 | the Zaurus syncs with the corresponding KDE-Pim/Pi |
58 | program on the Linux Desktop which syncs automatically | 58 | program on the Linux Desktop which syncs automatically |
59 | with the KDE-desktop data. | 59 | with the KDE-desktop data. |
60 | 60 | ||
61 | If you want to use the KDE-desktop calendar/addressbook applications, | 61 | If you want to use the KDE-desktop calendar/addressbook applications, |
62 | just install these apps in this package and use them as a syncing tool for the | 62 | just install these apps in this package and use them as a syncing tool for the |
63 | Zaurus <-> KDE-desktop sync. | 63 | Zaurus <-> KDE-desktop sync. |
64 | The sync requires a network connection from your Zaurus to | 64 | The sync requires a network connection from your Zaurus to |
65 | the PC. A detailed Sync HowTo is available in the | 65 | the PC. A detailed Sync HowTo is available in the |
66 | Help menu of the applications. | 66 | Help menu of the applications. |
67 | 67 | ||
68 | These applications makes it also possible, that you can sync | 68 | These applications makes it also possible, that you can sync |
69 | (or just export the data to) your mobile phone with your | 69 | (or just export the data to) your mobile phone with your |
70 | data of the KDE-desktop calendar/addressbook applications. | 70 | data of the KDE-desktop calendar/addressbook applications. |
71 | This is tested and working for Nokia mobile phones, | 71 | This is tested and working for Nokia mobile phones, |
72 | it may work with others as well. | 72 | it may work with others as well. |
73 | (More info about that: -> Sync HowTo) | 73 | (More info about that: -> Sync HowTo) |
74 | 74 | ||
75 | NOTE: | 75 | NOTE: |
76 | When using SuSE 9.1 you have to update your KDE to 3.3.x | 76 | When using SuSE 9.1 you have to update your KDE to 3.3.x |
77 | and you have to make an online update in SuSE 9.1 to make it | 77 | and you have to make an online update in SuSE 9.1 to make it |
78 | possible to get the infrared connection working, such that | 78 | possible to get the infrared connection working, such that |
79 | you can sync your (Nokia) mobile phone via infrared. | 79 | you can sync your (Nokia) mobile phone via infrared. |
80 | 80 | ||
81 | %files | 81 | %files |
82 | /opt/kde3/share/applnk/PIM-pi/ | 82 | /opt/kde3/share/applnk/PIM-pi/ |
83 | /opt/kdepimpi/ | 83 | /opt/kdepimpi/ |
84 | /usr/lib/libmicro* | 84 | /usr/lib/libmicro* |
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index dca42e0..c19a5ca 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -1,249 +1,250 @@ | |||
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 | // | 24 | // |
25 | // Journal Entry | 25 | // Journal Entry |
26 | 26 | ||
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qvbox.h> | 29 | #include <qvbox.h> |
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qtextcodec.h> | 33 | #include <qtextcodec.h> |
34 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qapplication.h> | ||
36 | 37 | ||
37 | #include <kdebug.h> | 38 | #include <kdebug.h> |
38 | #include <kglobal.h> | 39 | #include <kglobal.h> |
39 | #include <klocale.h> | 40 | #include <klocale.h> |
40 | #include <ktextedit.h> | 41 | #include <ktextedit.h> |
41 | #include <kfiledialog.h> | 42 | #include <kfiledialog.h> |
42 | #include <kmessagebox.h> | 43 | #include <kmessagebox.h> |
43 | #include "koprefs.h" | 44 | #include "koprefs.h" |
44 | 45 | ||
45 | #include <libkcal/journal.h> | 46 | #include <libkcal/journal.h> |
46 | #include <libkcal/calendarresources.h> | 47 | #include <libkcal/calendarresources.h> |
47 | #include <libkcal/resourcecalendar.h> | 48 | #include <libkcal/resourcecalendar.h> |
48 | #include <kresources/resourceselectdialog.h> | 49 | #include <kresources/resourceselectdialog.h> |
49 | 50 | ||
50 | #include "journalentry.h" | 51 | #include "journalentry.h" |
51 | //#include "journalentry.moc" | 52 | //#include "journalentry.moc" |
52 | #ifndef DESKTOP_VERSION | 53 | #ifndef DESKTOP_VERSION |
53 | #include <qpe/qpeapplication.h> | 54 | #include <qpe/qpeapplication.h> |
54 | #endif | 55 | #endif |
55 | JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | 56 | JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : |
56 | QFrame(parent) | 57 | QFrame(parent) |
57 | { | 58 | { |
58 | mCalendar = calendar; | 59 | mCalendar = calendar; |
59 | mJournal = 0; | 60 | mJournal = 0; |
60 | mDirty = false; | 61 | mDirty = false; |
61 | 62 | ||
62 | QHBox * vb = new QHBox ( this ); | 63 | QHBox * vb = new QHBox ( this ); |
63 | QPushButton * loadTemplate = new QPushButton( vb ); | 64 | QPushButton * loadTemplate = new QPushButton( vb ); |
64 | QPushButton * saveTemplate = new QPushButton( vb ); | 65 | QPushButton * saveTemplate = new QPushButton( vb ); |
65 | QIconSet icon; | 66 | QIconSet icon; |
66 | if ( QApplication::desktop()->width() < 321 ) | 67 | if ( QApplication::desktop()->width() < 321 ) |
67 | icon = SmallIcon("fileexport16"); | 68 | icon = SmallIcon("fileexport16"); |
68 | else | 69 | else |
69 | icon = SmallIcon("fileexport"); | 70 | icon = SmallIcon("fileexport"); |
70 | saveTemplate->setIconSet (icon ) ; | 71 | saveTemplate->setIconSet (icon ) ; |
71 | int size = saveTemplate->sizeHint().height(); | 72 | int size = saveTemplate->sizeHint().height(); |
72 | saveTemplate->setFixedSize( size, size ); | 73 | saveTemplate->setFixedSize( size, size ); |
73 | if ( QApplication::desktop()->width() < 321 ) | 74 | if ( QApplication::desktop()->width() < 321 ) |
74 | icon = SmallIcon("fileimport16"); | 75 | icon = SmallIcon("fileimport16"); |
75 | else | 76 | else |
76 | icon = SmallIcon("fileimport"); | 77 | icon = SmallIcon("fileimport"); |
77 | loadTemplate->setIconSet (icon ) ; | 78 | loadTemplate->setIconSet (icon ) ; |
78 | loadTemplate->setFixedSize( size, size ); | 79 | loadTemplate->setFixedSize( size, size ); |
79 | 80 | ||
80 | mTitleLabel = new QLabel(i18n("Title"),vb); | 81 | mTitleLabel = new QLabel(i18n("Title"),vb); |
81 | mTitleLabel->setMargin(2); | 82 | mTitleLabel->setMargin(2); |
82 | mTitleLabel->setAlignment(AlignCenter); | 83 | mTitleLabel->setAlignment(AlignCenter); |
83 | 84 | ||
84 | mEditor = new KTextEdit(this); | 85 | mEditor = new KTextEdit(this); |
85 | connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty())); | 86 | connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty())); |
86 | #ifndef DESKTOP_VERSION | 87 | #ifndef DESKTOP_VERSION |
87 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); | 88 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); |
88 | #endif | 89 | #endif |
89 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); | 90 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); |
90 | QBoxLayout *topLayout = new QVBoxLayout(this); | 91 | QBoxLayout *topLayout = new QVBoxLayout(this); |
91 | topLayout->addWidget(vb); | 92 | topLayout->addWidget(vb); |
92 | topLayout->addWidget(mEditor); | 93 | topLayout->addWidget(mEditor); |
93 | mEditor->installEventFilter(this); | 94 | mEditor->installEventFilter(this); |
94 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 95 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
95 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 96 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
96 | } | 97 | } |
97 | 98 | ||
98 | JournalEntry::~JournalEntry() | 99 | JournalEntry::~JournalEntry() |
99 | { | 100 | { |
100 | } | 101 | } |
101 | 102 | ||
102 | void JournalEntry::slotSaveTemplate() | 103 | void JournalEntry::slotSaveTemplate() |
103 | { | 104 | { |
104 | QString fileName =locateLocal( "templates", "journals" ); | 105 | QString fileName =locateLocal( "templates", "journals" ); |
105 | QDir t_dir; | 106 | QDir t_dir; |
106 | if ( !t_dir.exists(fileName) ) | 107 | if ( !t_dir.exists(fileName) ) |
107 | t_dir.mkdir ( fileName ); | 108 | t_dir.mkdir ( fileName ); |
108 | fileName += "/journal"; | 109 | fileName += "/journal"; |
109 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); | 110 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); |
110 | if ( fileName.length() == 0 ) | 111 | if ( fileName.length() == 0 ) |
111 | return; | 112 | return; |
112 | 113 | ||
113 | QFile fileIn( fileName ); | 114 | QFile fileIn( fileName ); |
114 | if (!fileIn.open( IO_WriteOnly ) ) { | 115 | if (!fileIn.open( IO_WriteOnly ) ) { |
115 | KMessageBox::error( this, i18n("Error saving template file\n '%1'.") | 116 | KMessageBox::error( this, i18n("Error saving template file\n '%1'.") |
116 | .arg( fileName ) ); | 117 | .arg( fileName ) ); |
117 | return; | 118 | return; |
118 | } | 119 | } |
119 | // QString text; | 120 | // QString text; |
120 | QTextStream tsIn( &fileIn ); | 121 | QTextStream tsIn( &fileIn ); |
121 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 122 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
122 | tsIn << mEditor->text(); | 123 | tsIn << mEditor->text(); |
123 | fileIn.close(); | 124 | fileIn.close(); |
124 | } | 125 | } |
125 | void JournalEntry::slotLoadTemplate() | 126 | void JournalEntry::slotLoadTemplate() |
126 | { | 127 | { |
127 | QString fileName =locateLocal( "templates", "journals" ); | 128 | QString fileName =locateLocal( "templates", "journals" ); |
128 | QDir t_dir; | 129 | QDir t_dir; |
129 | if ( !t_dir.exists(fileName) ) | 130 | if ( !t_dir.exists(fileName) ) |
130 | t_dir.mkdir ( fileName ); | 131 | t_dir.mkdir ( fileName ); |
131 | fileName += "/journal"; | 132 | fileName += "/journal"; |
132 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); | 133 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); |
133 | if ( fileName.length() == 0 ) | 134 | if ( fileName.length() == 0 ) |
134 | return; | 135 | return; |
135 | QFile fileIn( fileName ); | 136 | QFile fileIn( fileName ); |
136 | if (!fileIn.open( IO_ReadOnly ) ) { | 137 | if (!fileIn.open( IO_ReadOnly ) ) { |
137 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") | 138 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") |
138 | .arg( fileName ) ); | 139 | .arg( fileName ) ); |
139 | return; | 140 | return; |
140 | } | 141 | } |
141 | QTextStream tsIn( &fileIn ); | 142 | QTextStream tsIn( &fileIn ); |
142 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 143 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
143 | QString text = tsIn.read(); | 144 | QString text = tsIn.read(); |
144 | fileIn.close(); | 145 | fileIn.close(); |
145 | int line, col; | 146 | int line, col; |
146 | mEditor->getCursorPosition (& line, & col ); | 147 | mEditor->getCursorPosition (& line, & col ); |
147 | mEditor-> insertAt ( text, line, col, true ); | 148 | mEditor-> insertAt ( text, line, col, true ); |
148 | //mEditor->setIgnoreMark( true ); | 149 | //mEditor->setIgnoreMark( true ); |
149 | setDirty(); | 150 | setDirty(); |
150 | } | 151 | } |
151 | void JournalEntry::setDate(const QDate &date) | 152 | void JournalEntry::setDate(const QDate &date) |
152 | { | 153 | { |
153 | writeJournal(); | 154 | writeJournal(); |
154 | 155 | ||
155 | mTitleLabel->setText(KGlobal::locale()->formatDate(date)); | 156 | mTitleLabel->setText(KGlobal::locale()->formatDate(date)); |
156 | 157 | ||
157 | 158 | ||
158 | mDate = date; | 159 | mDate = date; |
159 | } | 160 | } |
160 | 161 | ||
161 | void JournalEntry::setJournal(Journal *journal) | 162 | void JournalEntry::setJournal(Journal *journal) |
162 | { | 163 | { |
163 | writeJournal(); | 164 | writeJournal(); |
164 | 165 | ||
165 | mJournal = journal; | 166 | mJournal = journal; |
166 | 167 | ||
167 | mEditor->setText(mJournal->description()); | 168 | mEditor->setText(mJournal->description()); |
168 | 169 | ||
169 | mDirty = false; | 170 | mDirty = false; |
170 | } | 171 | } |
171 | 172 | ||
172 | Journal *JournalEntry::journal() const | 173 | Journal *JournalEntry::journal() const |
173 | { | 174 | { |
174 | return mJournal; | 175 | return mJournal; |
175 | } | 176 | } |
176 | 177 | ||
177 | void JournalEntry::setDirty() | 178 | void JournalEntry::setDirty() |
178 | { | 179 | { |
179 | mDirty = true; | 180 | mDirty = true; |
180 | 181 | ||
181 | // kdDebug() << "JournalEntry::setDirty()" << endl; | 182 | // kdDebug() << "JournalEntry::setDirty()" << endl; |
182 | } | 183 | } |
183 | 184 | ||
184 | void JournalEntry::clear() | 185 | void JournalEntry::clear() |
185 | { | 186 | { |
186 | mJournal = 0; | 187 | mJournal = 0; |
187 | mEditor->setText(""); | 188 | mEditor->setText(""); |
188 | } | 189 | } |
189 | 190 | ||
190 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) | 191 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) |
191 | { | 192 | { |
192 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; | 193 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; |
193 | 194 | ||
194 | if ( e->type() == QEvent::FocusOut ) { | 195 | if ( e->type() == QEvent::FocusOut ) { |
195 | writeJournal(); | 196 | writeJournal(); |
196 | } | 197 | } |
197 | if ( e->type() == QEvent::KeyPress ) { | 198 | if ( e->type() == QEvent::KeyPress ) { |
198 | QKeyEvent * k = (QKeyEvent *) e; | 199 | QKeyEvent * k = (QKeyEvent *) e; |
199 | if ( k->state() == Qt::ControlButton ) { | 200 | if ( k->state() == Qt::ControlButton ) { |
200 | k->ignore(); | 201 | k->ignore(); |
201 | //return true; | 202 | //return true; |
202 | } | 203 | } |
203 | } | 204 | } |
204 | 205 | ||
205 | return QFrame::eventFilter( o, e ); // standard event processing | 206 | return QFrame::eventFilter( o, e ); // standard event processing |
206 | } | 207 | } |
207 | 208 | ||
208 | void JournalEntry::writeJournal() | 209 | void JournalEntry::writeJournal() |
209 | { | 210 | { |
210 | // kdDebug() << "JournalEntry::writeJournal()" << endl; | 211 | // kdDebug() << "JournalEntry::writeJournal()" << endl; |
211 | if (!mDirty) return; | 212 | if (!mDirty) return; |
212 | 213 | ||
213 | if (mEditor->text().isEmpty()) { | 214 | if (mEditor->text().isEmpty()) { |
214 | if ( mJournal ) { | 215 | if ( mJournal ) { |
215 | mDirty = false; | 216 | mDirty = false; |
216 | bool conf = KOPrefs::instance()->mConfirm; | 217 | bool conf = KOPrefs::instance()->mConfirm; |
217 | KOPrefs::instance()->mConfirm = false; | 218 | KOPrefs::instance()->mConfirm = false; |
218 | emit deleteJournal(mJournal); | 219 | emit deleteJournal(mJournal); |
219 | KOPrefs::instance()->mConfirm = conf; | 220 | KOPrefs::instance()->mConfirm = conf; |
220 | mJournal = 0; | 221 | mJournal = 0; |
221 | } | 222 | } |
222 | return; | 223 | return; |
223 | } | 224 | } |
224 | 225 | ||
225 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; | 226 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; |
226 | 227 | ||
227 | if (!mJournal) { | 228 | if (!mJournal) { |
228 | mJournal = new Journal; | 229 | mJournal = new Journal; |
229 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); | 230 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); |
230 | mCalendar->addJournal(mJournal); | 231 | mCalendar->addJournal(mJournal); |
231 | } | 232 | } |
232 | 233 | ||
233 | mJournal->setDescription(mEditor->text()); | 234 | mJournal->setDescription(mEditor->text()); |
234 | //qDebug("tttt%s ", mEditor->text().latin1()); | 235 | //qDebug("tttt%s ", mEditor->text().latin1()); |
235 | 236 | ||
236 | mDirty = false; | 237 | mDirty = false; |
237 | } | 238 | } |
238 | 239 | ||
239 | void JournalEntry::flushEntry() | 240 | void JournalEntry::flushEntry() |
240 | { | 241 | { |
241 | if (!mDirty) return; | 242 | if (!mDirty) return; |
242 | 243 | ||
243 | writeJournal(); | 244 | writeJournal(); |
244 | } | 245 | } |
245 | void JournalEntry::keyPressEvent ( QKeyEvent * e ) | 246 | void JournalEntry::keyPressEvent ( QKeyEvent * e ) |
246 | { | 247 | { |
247 | e->ignore(); | 248 | e->ignore(); |
248 | 249 | ||
249 | } | 250 | } |
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index ce0d7a9..cd78f54 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp | |||
@@ -1,415 +1,416 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,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 <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qfiledialog.h> | 25 | #include <qfiledialog.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qbuttongroup.h> | 28 | #include <qbuttongroup.h> |
29 | #include <qvgroupbox.h> | 29 | #include <qvgroupbox.h> |
30 | #include <qwidgetstack.h> | 30 | #include <qwidgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qapplication.h> | ||
32 | 33 | ||
33 | #include <kglobal.h> | 34 | #include <kglobal.h> |
34 | #include <klocale.h> | 35 | #include <klocale.h> |
35 | #include <kiconloader.h> | 36 | #include <kiconloader.h> |
36 | #include <kmessagebox.h> | 37 | #include <kmessagebox.h> |
37 | #include <kdebug.h> | 38 | #include <kdebug.h> |
38 | #include <krestrictedline.h> | 39 | #include <krestrictedline.h> |
39 | #include <kstandarddirs.h> | 40 | #include <kstandarddirs.h> |
40 | #include <kfiledialog.h> | 41 | #include <kfiledialog.h> |
41 | 42 | ||
42 | #include <libkcal/todo.h> | 43 | #include <libkcal/todo.h> |
43 | 44 | ||
44 | #include <libkdepim/kdateedit.h> | 45 | #include <libkdepim/kdateedit.h> |
45 | 46 | ||
46 | #include "koprefs.h" | 47 | #include "koprefs.h" |
47 | #include "ktimeedit.h" | 48 | #include "ktimeedit.h" |
48 | 49 | ||
49 | #include "koeditorgeneraltodo.h" | 50 | #include "koeditorgeneraltodo.h" |
50 | #include "kolocationbox.h" | 51 | #include "kolocationbox.h" |
51 | 52 | ||
52 | KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, | 53 | KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, |
53 | const char* name) | 54 | const char* name) |
54 | : KOEditorGeneral( parent, name) | 55 | : KOEditorGeneral( parent, name) |
55 | { | 56 | { |
56 | } | 57 | } |
57 | 58 | ||
58 | KOEditorGeneralTodo::~KOEditorGeneralTodo() | 59 | KOEditorGeneralTodo::~KOEditorGeneralTodo() |
59 | { | 60 | { |
60 | } | 61 | } |
61 | 62 | ||
62 | void KOEditorGeneralTodo::finishSetup() | 63 | void KOEditorGeneralTodo::finishSetup() |
63 | { | 64 | { |
64 | 65 | ||
65 | // QWidget::setTabOrder(mSummaryEdit, mLocationEdit); | 66 | // QWidget::setTabOrder(mSummaryEdit, mLocationEdit); |
66 | // QWidget::setTabOrder(mLocationEdit, mDueCheck); | 67 | // QWidget::setTabOrder(mLocationEdit, mDueCheck); |
67 | // QWidget::setTabOrder(mDueCheck, mDueDateEdit); | 68 | // QWidget::setTabOrder(mDueCheck, mDueDateEdit); |
68 | // QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); | 69 | // QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); |
69 | // QWidget::setTabOrder(mDueTimeEdit, mStartCheck); | 70 | // QWidget::setTabOrder(mDueTimeEdit, mStartCheck); |
70 | // QWidget::setTabOrder(mStartCheck, mStartDateEdit); | 71 | // QWidget::setTabOrder(mStartCheck, mStartDateEdit); |
71 | // QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); | 72 | // QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); |
72 | // QWidget::setTabOrder(mStartTimeEdit, mTimeButton); | 73 | // QWidget::setTabOrder(mStartTimeEdit, mTimeButton); |
73 | // QWidget::setTabOrder(mTimeButton, mCompletedCombo); | 74 | // QWidget::setTabOrder(mTimeButton, mCompletedCombo); |
74 | // QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); | 75 | // QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); |
75 | // QWidget::setTabOrder(mPriorityCombo, mAlarmButton); | 76 | // QWidget::setTabOrder(mPriorityCombo, mAlarmButton); |
76 | // QWidget::setTabOrder(mAlarmButton, mCategoriesButton); | 77 | // QWidget::setTabOrder(mAlarmButton, mCategoriesButton); |
77 | // QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); | 78 | // QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); |
78 | // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); | 79 | // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); |
79 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 80 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
80 | mSummaryEdit->setFocus(); | 81 | mSummaryEdit->setFocus(); |
81 | } | 82 | } |
82 | 83 | ||
83 | void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) | 84 | void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) |
84 | { | 85 | { |
85 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); | 86 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); |
86 | 87 | ||
87 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, | 88 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, |
88 | i18n("Date && Time"),parent); | 89 | i18n("Date && Time"),parent); |
89 | timeLayout->addWidget(timeGroupBox); | 90 | timeLayout->addWidget(timeGroupBox); |
90 | timeGroupBox->layout()->setSpacing( 0 ); | 91 | timeGroupBox->layout()->setSpacing( 0 ); |
91 | timeGroupBox->layout()->setMargin( 5 ); | 92 | timeGroupBox->layout()->setMargin( 5 ); |
92 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); | 93 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); |
93 | 94 | ||
94 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); | 95 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); |
95 | layoutTimeBox->setSpacing(topLayout->spacing()); | 96 | layoutTimeBox->setSpacing(topLayout->spacing()); |
96 | layoutTimeBox->setColStretch( 1, 1 ); | 97 | layoutTimeBox->setColStretch( 1, 1 ); |
97 | 98 | ||
98 | mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); | 99 | mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); |
99 | layoutTimeBox->addWidget(mDueCheck,0,0); | 100 | layoutTimeBox->addWidget(mDueCheck,0,0); |
100 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); | 101 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); |
101 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); | 102 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); |
102 | 103 | ||
103 | 104 | ||
104 | mDueDateEdit = new KDateEdit(timeBoxFrame); | 105 | mDueDateEdit = new KDateEdit(timeBoxFrame); |
105 | layoutTimeBox->addWidget(mDueDateEdit,0,1); | 106 | layoutTimeBox->addWidget(mDueDateEdit,0,1); |
106 | 107 | ||
107 | mDueTimeEdit = new KOTimeEdit(timeBoxFrame); | 108 | mDueTimeEdit = new KOTimeEdit(timeBoxFrame); |
108 | layoutTimeBox->addWidget(mDueTimeEdit,0,2); | 109 | layoutTimeBox->addWidget(mDueTimeEdit,0,2); |
109 | 110 | ||
110 | 111 | ||
111 | mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); | 112 | mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); |
112 | layoutTimeBox->addWidget(mStartCheck,1,0); | 113 | layoutTimeBox->addWidget(mStartCheck,1,0); |
113 | connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); | 114 | connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); |
114 | 115 | ||
115 | mStartDateEdit = new KDateEdit(timeBoxFrame); | 116 | mStartDateEdit = new KDateEdit(timeBoxFrame); |
116 | layoutTimeBox->addWidget(mStartDateEdit,1,1); | 117 | layoutTimeBox->addWidget(mStartDateEdit,1,1); |
117 | 118 | ||
118 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); | 119 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); |
119 | layoutTimeBox->addWidget(mStartTimeEdit,1,2); | 120 | layoutTimeBox->addWidget(mStartTimeEdit,1,2); |
120 | 121 | ||
121 | 122 | ||
122 | mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); | 123 | mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); |
123 | layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); | 124 | layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); |
124 | 125 | ||
125 | connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); | 126 | connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); |
126 | 127 | ||
127 | // some more layouting | 128 | // some more layouting |
128 | //layoutTimeBox->setColStretch(3,1); | 129 | //layoutTimeBox->setColStretch(3,1); |
129 | } | 130 | } |
130 | 131 | ||
131 | 132 | ||
132 | void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) | 133 | void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) |
133 | { | 134 | { |
134 | mCompletedCombo = new QComboBox(parent); | 135 | mCompletedCombo = new QComboBox(parent); |
135 | // xgettext:no-c-format | 136 | // xgettext:no-c-format |
136 | mCompletedCombo->insertItem(i18n(" 0 %")); | 137 | mCompletedCombo->insertItem(i18n(" 0 %")); |
137 | // xgettext:no-c-format | 138 | // xgettext:no-c-format |
138 | mCompletedCombo->insertItem(i18n(" 20 %")); | 139 | mCompletedCombo->insertItem(i18n(" 20 %")); |
139 | // xgettext:no-c-format | 140 | // xgettext:no-c-format |
140 | mCompletedCombo->insertItem(i18n(" 40 %")); | 141 | mCompletedCombo->insertItem(i18n(" 40 %")); |
141 | // xgettext:no-c-format | 142 | // xgettext:no-c-format |
142 | mCompletedCombo->insertItem(i18n(" 60 %")); | 143 | mCompletedCombo->insertItem(i18n(" 60 %")); |
143 | // xgettext:no-c-format | 144 | // xgettext:no-c-format |
144 | mCompletedCombo->insertItem(i18n(" 80 %")); | 145 | mCompletedCombo->insertItem(i18n(" 80 %")); |
145 | // xgettext:no-c-format | 146 | // xgettext:no-c-format |
146 | mCompletedCombo->insertItem(i18n("100 %")); | 147 | mCompletedCombo->insertItem(i18n("100 %")); |
147 | connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); | 148 | connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); |
148 | topLayout->addWidget(mCompletedCombo); | 149 | topLayout->addWidget(mCompletedCombo); |
149 | 150 | ||
150 | mCompletedLabel = new QLabel(i18n("completed"),parent); | 151 | mCompletedLabel = new QLabel(i18n("completed"),parent); |
151 | topLayout->addWidget(mCompletedLabel); | 152 | topLayout->addWidget(mCompletedLabel); |
152 | 153 | ||
153 | mCompleteDateEdit = new KDateEdit(parent); | 154 | mCompleteDateEdit = new KDateEdit(parent); |
154 | topLayout->addWidget(mCompleteDateEdit ); | 155 | topLayout->addWidget(mCompleteDateEdit ); |
155 | 156 | ||
156 | mCompleteTimeEdit = new KOTimeEdit(parent); | 157 | mCompleteTimeEdit = new KOTimeEdit(parent); |
157 | topLayout->addWidget( mCompleteTimeEdit); | 158 | topLayout->addWidget( mCompleteTimeEdit); |
158 | 159 | ||
159 | mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); | 160 | mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); |
160 | mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); | 161 | mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); |
161 | 162 | ||
162 | if ( QApplication::desktop()->width() < 320 ) { | 163 | if ( QApplication::desktop()->width() < 320 ) { |
163 | mCompleteDateEdit->setMaximumWidth( 85 ); | 164 | mCompleteDateEdit->setMaximumWidth( 85 ); |
164 | topLayout->setSpacing( 0 ); | 165 | topLayout->setSpacing( 0 ); |
165 | } | 166 | } |
166 | } | 167 | } |
167 | 168 | ||
168 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) | 169 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) |
169 | { | 170 | { |
170 | 171 | ||
171 | QHBox* h = new QHBox ( parent ); | 172 | QHBox* h = new QHBox ( parent ); |
172 | topLayout->addWidget( h ); | 173 | topLayout->addWidget( h ); |
173 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); | 174 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); |
174 | // topLayout->addWidget(priorityLabel); | 175 | // topLayout->addWidget(priorityLabel); |
175 | mPriorityCombo = new QComboBox( h ); | 176 | mPriorityCombo = new QComboBox( h ); |
176 | mPriorityCombo->insertItem(i18n("1 (high)")); | 177 | mPriorityCombo->insertItem(i18n("1 (high)")); |
177 | mPriorityCombo->insertItem(i18n("2")); | 178 | mPriorityCombo->insertItem(i18n("2")); |
178 | mPriorityCombo->insertItem(i18n("3")); | 179 | mPriorityCombo->insertItem(i18n("3")); |
179 | mPriorityCombo->insertItem(i18n("4")); | 180 | mPriorityCombo->insertItem(i18n("4")); |
180 | mPriorityCombo->insertItem(i18n("5 (low)")); | 181 | mPriorityCombo->insertItem(i18n("5 (low)")); |
181 | //topLayout->addWidget(mPriorityCombo); | 182 | //topLayout->addWidget(mPriorityCombo); |
182 | } | 183 | } |
183 | 184 | ||
184 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) | 185 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) |
185 | { | 186 | { |
186 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); | 187 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); |
187 | 188 | ||
188 | initCompletion( parent, statusLayout ); | 189 | initCompletion( parent, statusLayout ); |
189 | 190 | ||
190 | statusLayout->addStretch( 1 ); | 191 | statusLayout->addStretch( 1 ); |
191 | 192 | ||
192 | initPriority( parent, statusLayout ); | 193 | initPriority( parent, statusLayout ); |
193 | } | 194 | } |
194 | 195 | ||
195 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) | 196 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) |
196 | { | 197 | { |
197 | 198 | ||
198 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 199 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
199 | mLocationEdit->load(KOLocationBox::LOCATION); | 200 | mLocationEdit->load(KOLocationBox::LOCATION); |
200 | KOEditorGeneral::setDefaults(allDay); | 201 | KOEditorGeneral::setDefaults(allDay); |
201 | 202 | ||
202 | mTimeButton->setChecked( !allDay ); | 203 | mTimeButton->setChecked( !allDay ); |
203 | if(mTimeButton->isChecked()) { | 204 | if(mTimeButton->isChecked()) { |
204 | mTimeButton->setEnabled(true); | 205 | mTimeButton->setEnabled(true); |
205 | } | 206 | } |
206 | else { | 207 | else { |
207 | mTimeButton->setEnabled(false); | 208 | mTimeButton->setEnabled(false); |
208 | } | 209 | } |
209 | 210 | ||
210 | enableTimeEdits( !allDay ); | 211 | enableTimeEdits( !allDay ); |
211 | if ( due.isValid() ) { | 212 | if ( due.isValid() ) { |
212 | mDueCheck->setChecked(true); | 213 | mDueCheck->setChecked(true); |
213 | enableDueEdit(true); | 214 | enableDueEdit(true); |
214 | } else { | 215 | } else { |
215 | mDueCheck->setChecked(false); | 216 | mDueCheck->setChecked(false); |
216 | enableDueEdit(false); | 217 | enableDueEdit(false); |
217 | due = QDateTime::currentDateTime().addDays(7); | 218 | due = QDateTime::currentDateTime().addDays(7); |
218 | } | 219 | } |
219 | 220 | ||
220 | alarmDisable(true); | 221 | alarmDisable(true); |
221 | 222 | ||
222 | mStartCheck->setChecked(false); | 223 | mStartCheck->setChecked(false); |
223 | enableStartEdit(false); | 224 | enableStartEdit(false); |
224 | 225 | ||
225 | mDueDateEdit->setDate(due.date()); | 226 | mDueDateEdit->setDate(due.date()); |
226 | mDueTimeEdit->setTime(due.time()); | 227 | mDueTimeEdit->setTime(due.time()); |
227 | due = due.addDays(-7); | 228 | due = due.addDays(-7); |
228 | mStartDateEdit->setDate(due.date()); | 229 | mStartDateEdit->setDate(due.date()); |
229 | mStartTimeEdit->setTime(due.time()); | 230 | mStartTimeEdit->setTime(due.time()); |
230 | 231 | ||
231 | mPriorityCombo->setCurrentItem(2); | 232 | mPriorityCombo->setCurrentItem(2); |
232 | mCompletedLabel->setText(i18n("completed"));; | 233 | mCompletedLabel->setText(i18n("completed"));; |
233 | mCompletedCombo->setCurrentItem(0); | 234 | mCompletedCombo->setCurrentItem(0); |
234 | } | 235 | } |
235 | 236 | ||
236 | void KOEditorGeneralTodo::readTodo(Todo *todo) | 237 | void KOEditorGeneralTodo::readTodo(Todo *todo) |
237 | { | 238 | { |
238 | 239 | ||
239 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 240 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
240 | mLocationEdit->load(KOLocationBox::LOCATION); | 241 | mLocationEdit->load(KOLocationBox::LOCATION); |
241 | KOEditorGeneral::readIncidence(todo); | 242 | KOEditorGeneral::readIncidence(todo); |
242 | 243 | ||
243 | QDateTime dueDT; | 244 | QDateTime dueDT; |
244 | 245 | ||
245 | if (todo->hasDueDate()) { | 246 | if (todo->hasDueDate()) { |
246 | enableAlarmEdit(true); | 247 | enableAlarmEdit(true); |
247 | dueDT = todo->dtDue(); | 248 | dueDT = todo->dtDue(); |
248 | mDueDateEdit->setDate(todo->dtDue().date()); | 249 | mDueDateEdit->setDate(todo->dtDue().date()); |
249 | mDueTimeEdit->setTime(todo->dtDue().time()); | 250 | mDueTimeEdit->setTime(todo->dtDue().time()); |
250 | mDueCheck->setChecked(true); | 251 | mDueCheck->setChecked(true); |
251 | } else { | 252 | } else { |
252 | alarmDisable(true); | 253 | alarmDisable(true); |
253 | mDueDateEdit->setEnabled(false); | 254 | mDueDateEdit->setEnabled(false); |
254 | mDueTimeEdit->setEnabled(false); | 255 | mDueTimeEdit->setEnabled(false); |
255 | mDueDateEdit->setDate(QDate::currentDate()); | 256 | mDueDateEdit->setDate(QDate::currentDate()); |
256 | mDueTimeEdit->setTime(QTime::currentTime()); | 257 | mDueTimeEdit->setTime(QTime::currentTime()); |
257 | mDueCheck->setChecked(false); | 258 | mDueCheck->setChecked(false); |
258 | } | 259 | } |
259 | 260 | ||
260 | if (todo->hasStartDate()) { | 261 | if (todo->hasStartDate()) { |
261 | mStartDateEdit->setDate(todo->dtStart().date()); | 262 | mStartDateEdit->setDate(todo->dtStart().date()); |
262 | mStartTimeEdit->setTime(todo->dtStart().time()); | 263 | mStartTimeEdit->setTime(todo->dtStart().time()); |
263 | mStartCheck->setChecked(true); | 264 | mStartCheck->setChecked(true); |
264 | } else { | 265 | } else { |
265 | mStartDateEdit->setEnabled(false); | 266 | mStartDateEdit->setEnabled(false); |
266 | mStartTimeEdit->setEnabled(false); | 267 | mStartTimeEdit->setEnabled(false); |
267 | mStartDateEdit->setDate(QDate::currentDate()); | 268 | mStartDateEdit->setDate(QDate::currentDate()); |
268 | mStartTimeEdit->setTime(QTime::currentTime()); | 269 | mStartTimeEdit->setTime(QTime::currentTime()); |
269 | mStartCheck->setChecked(false); | 270 | mStartCheck->setChecked(false); |
270 | } | 271 | } |
271 | 272 | ||
272 | mTimeButton->setChecked( !todo->doesFloat() ); | 273 | mTimeButton->setChecked( !todo->doesFloat() ); |
273 | 274 | ||
274 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); | 275 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); |
275 | if (todo->isCompleted() && todo->hasCompletedDate()) { | 276 | if (todo->isCompleted() && todo->hasCompletedDate()) { |
276 | mCompleted = todo->completed(); | 277 | mCompleted = todo->completed(); |
277 | } | 278 | } |
278 | setCompletedDate(); | 279 | setCompletedDate(); |
279 | 280 | ||
280 | mPriorityCombo->setCurrentItem(todo->priority()-1); | 281 | mPriorityCombo->setCurrentItem(todo->priority()-1); |
281 | } | 282 | } |
282 | 283 | ||
283 | void KOEditorGeneralTodo::writeTodo(Todo *todo) | 284 | void KOEditorGeneralTodo::writeTodo(Todo *todo) |
284 | { | 285 | { |
285 | KOEditorGeneral::writeIncidence(todo); | 286 | KOEditorGeneral::writeIncidence(todo); |
286 | 287 | ||
287 | // temp. until something better happens. | 288 | // temp. until something better happens. |
288 | QString tmpStr; | 289 | QString tmpStr; |
289 | 290 | ||
290 | todo->setHasDueDate(mDueCheck->isChecked()); | 291 | todo->setHasDueDate(mDueCheck->isChecked()); |
291 | todo->setHasStartDate(mStartCheck->isChecked()); | 292 | todo->setHasStartDate(mStartCheck->isChecked()); |
292 | 293 | ||
293 | QDate tmpDate; | 294 | QDate tmpDate; |
294 | QTime tmpTime; | 295 | QTime tmpTime; |
295 | QDateTime tmpDT; | 296 | QDateTime tmpDT; |
296 | if ( mTimeButton->isChecked() ) { | 297 | if ( mTimeButton->isChecked() ) { |
297 | todo->setFloats(false); | 298 | todo->setFloats(false); |
298 | 299 | ||
299 | // set due date/time | 300 | // set due date/time |
300 | tmpDate = mDueDateEdit->date(); | 301 | tmpDate = mDueDateEdit->date(); |
301 | tmpTime = mDueTimeEdit->getTime(); | 302 | tmpTime = mDueTimeEdit->getTime(); |
302 | tmpDT.setDate(tmpDate); | 303 | tmpDT.setDate(tmpDate); |
303 | tmpDT.setTime(tmpTime); | 304 | tmpDT.setTime(tmpTime); |
304 | todo->setDtDue(tmpDT); | 305 | todo->setDtDue(tmpDT); |
305 | 306 | ||
306 | // set start date/time | 307 | // set start date/time |
307 | tmpDate = mStartDateEdit->date(); | 308 | tmpDate = mStartDateEdit->date(); |
308 | tmpTime = mStartTimeEdit->getTime(); | 309 | tmpTime = mStartTimeEdit->getTime(); |
309 | tmpDT.setDate(tmpDate); | 310 | tmpDT.setDate(tmpDate); |
310 | tmpDT.setTime(tmpTime); | 311 | tmpDT.setTime(tmpTime); |
311 | todo->setDtStart(tmpDT); | 312 | todo->setDtStart(tmpDT); |
312 | } else { | 313 | } else { |
313 | todo->setFloats(true); | 314 | todo->setFloats(true); |
314 | 315 | ||
315 | // need to change this. | 316 | // need to change this. |
316 | tmpDate = mDueDateEdit->date(); | 317 | tmpDate = mDueDateEdit->date(); |
317 | tmpTime.setHMS(0,0,0); | 318 | tmpTime.setHMS(0,0,0); |
318 | tmpDT.setDate(tmpDate); | 319 | tmpDT.setDate(tmpDate); |
319 | tmpDT.setTime(tmpTime); | 320 | tmpDT.setTime(tmpTime); |
320 | todo->setDtDue(tmpDT); | 321 | todo->setDtDue(tmpDT); |
321 | 322 | ||
322 | tmpDate = mStartDateEdit->date(); | 323 | tmpDate = mStartDateEdit->date(); |
323 | tmpTime.setHMS(0,0,0); | 324 | tmpTime.setHMS(0,0,0); |
324 | tmpDT.setDate(tmpDate); | 325 | tmpDT.setDate(tmpDate); |
325 | tmpDT.setTime(tmpTime); | 326 | tmpDT.setTime(tmpTime); |
326 | todo->setDtStart(tmpDT); | 327 | todo->setDtStart(tmpDT); |
327 | } | 328 | } |
328 | todo->setPriority(mPriorityCombo->currentItem()+1); | 329 | todo->setPriority(mPriorityCombo->currentItem()+1); |
329 | 330 | ||
330 | // set completion state | 331 | // set completion state |
331 | if ( mCompletedCombo->currentItem() == 5 ) { | 332 | if ( mCompletedCombo->currentItem() == 5 ) { |
332 | QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() ); | 333 | QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() ); |
333 | if ( comp.isValid () ) { | 334 | if ( comp.isValid () ) { |
334 | todo->setPercentComplete(0); | 335 | todo->setPercentComplete(0); |
335 | todo->setPercentComplete(100); | 336 | todo->setPercentComplete(100); |
336 | todo->setCompleted(comp); | 337 | todo->setCompleted(comp); |
337 | } else { | 338 | } else { |
338 | todo->setPercentComplete( 100 ); | 339 | todo->setPercentComplete( 100 ); |
339 | if ( mCompleted.isValid() ) | 340 | if ( mCompleted.isValid() ) |
340 | todo->setCompleted(mCompleted); | 341 | todo->setCompleted(mCompleted); |
341 | } | 342 | } |
342 | } else { | 343 | } else { |
343 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); | 344 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); |
344 | } | 345 | } |
345 | 346 | ||
346 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); | 347 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); |
347 | } | 348 | } |
348 | 349 | ||
349 | void KOEditorGeneralTodo::enableDueEdit(bool enable) | 350 | void KOEditorGeneralTodo::enableDueEdit(bool enable) |
350 | { | 351 | { |
351 | mDueDateEdit->setEnabled( enable ); | 352 | mDueDateEdit->setEnabled( enable ); |
352 | 353 | ||
353 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 354 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
354 | mTimeButton->setEnabled(true); | 355 | mTimeButton->setEnabled(true); |
355 | } | 356 | } |
356 | else { | 357 | else { |
357 | mTimeButton->setEnabled(false); | 358 | mTimeButton->setEnabled(false); |
358 | mTimeButton->setChecked(false); | 359 | mTimeButton->setChecked(false); |
359 | } | 360 | } |
360 | 361 | ||
361 | if (enable) { | 362 | if (enable) { |
362 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); | 363 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); |
363 | } else { | 364 | } else { |
364 | mDueTimeEdit->setEnabled( false ); | 365 | mDueTimeEdit->setEnabled( false ); |
365 | } | 366 | } |
366 | } | 367 | } |
367 | 368 | ||
368 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) | 369 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) |
369 | { | 370 | { |
370 | mStartDateEdit->setEnabled( enable ); | 371 | mStartDateEdit->setEnabled( enable ); |
371 | 372 | ||
372 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 373 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
373 | mTimeButton->setEnabled(true); | 374 | mTimeButton->setEnabled(true); |
374 | } | 375 | } |
375 | else { | 376 | else { |
376 | mTimeButton->setEnabled(false); | 377 | mTimeButton->setEnabled(false); |
377 | mTimeButton->setChecked(false); | 378 | mTimeButton->setChecked(false); |
378 | } | 379 | } |
379 | 380 | ||
380 | if (enable) { | 381 | if (enable) { |
381 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); | 382 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); |
382 | } else { | 383 | } else { |
383 | mStartTimeEdit->setEnabled( false ); | 384 | mStartTimeEdit->setEnabled( false ); |
384 | } | 385 | } |
385 | } | 386 | } |
386 | 387 | ||
387 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) | 388 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) |
388 | { | 389 | { |
389 | if(mStartCheck->isChecked()) { | 390 | if(mStartCheck->isChecked()) { |
390 | mStartTimeEdit->setEnabled( enable ); | 391 | mStartTimeEdit->setEnabled( enable ); |
391 | } | 392 | } |
392 | if(mDueCheck->isChecked()) { | 393 | if(mDueCheck->isChecked()) { |
393 | mDueTimeEdit->setEnabled( enable ); | 394 | mDueTimeEdit->setEnabled( enable ); |
394 | } | 395 | } |
395 | } | 396 | } |
396 | 397 | ||
397 | void KOEditorGeneralTodo::showAlarm() | 398 | void KOEditorGeneralTodo::showAlarm() |
398 | { | 399 | { |
399 | if ( mDueCheck->isChecked() ) { | 400 | if ( mDueCheck->isChecked() ) { |
400 | alarmDisable(false); | 401 | alarmDisable(false); |
401 | } | 402 | } |
402 | else { | 403 | else { |
403 | alarmDisable(true); | 404 | alarmDisable(true); |
404 | } | 405 | } |
405 | } | 406 | } |
406 | 407 | ||
407 | bool KOEditorGeneralTodo::validateInput() | 408 | bool KOEditorGeneralTodo::validateInput() |
408 | { | 409 | { |
409 | if (mDueCheck->isChecked()) { | 410 | if (mDueCheck->isChecked()) { |
410 | if (!mDueDateEdit->inputIsValid()) { | 411 | if (!mDueDateEdit->inputIsValid()) { |
411 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); | 412 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); |
412 | return false; | 413 | return false; |
413 | } | 414 | } |
414 | } | 415 | } |
415 | 416 | ||
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index cb519b2..65accdc 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,408 +1,409 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,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 | 19 | ||
20 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | #include <qfont.h> | 21 | #include <qfont.h> |
22 | #include <qfontmetrics.h> | 22 | #include <qfontmetrics.h> |
23 | #include <qkeycode.h> | 23 | #include <qkeycode.h> |
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qtimer.h> | ||
25 | #include <qvbox.h> | 26 | #include <qvbox.h> |
26 | #include <qwidgetstack.h> | 27 | #include <qwidgetstack.h> |
27 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
28 | #include <qtooltip.h> | 29 | #include <qtooltip.h> |
29 | #include <qpainter.h> | 30 | #include <qpainter.h> |
30 | #include <qwhatsthis.h> | 31 | #include <qwhatsthis.h> |
31 | #ifndef DESKTOP_VERSION | 32 | #ifndef DESKTOP_VERSION |
32 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
33 | #else | 34 | #else |
34 | #include <qapplication.h> | 35 | #include <qapplication.h> |
35 | #endif | 36 | #endif |
36 | 37 | ||
37 | #include <kdebug.h> | 38 | #include <kdebug.h> |
38 | #include <klocale.h> | 39 | #include <klocale.h> |
39 | #include <kglobal.h> | 40 | #include <kglobal.h> |
40 | #include <kconfig.h> | 41 | #include <kconfig.h> |
41 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
42 | 43 | ||
43 | #include <kcalendarsystem.h> | 44 | #include <kcalendarsystem.h> |
44 | 45 | ||
45 | #ifndef KORG_NOPRINTER | 46 | #ifndef KORG_NOPRINTER |
46 | #include "calprinter.h" | 47 | #include "calprinter.h" |
47 | #endif | 48 | #endif |
48 | #include "koprefs.h" | 49 | #include "koprefs.h" |
49 | #ifndef KORG_NOPLUGINS | 50 | #ifndef KORG_NOPLUGINS |
50 | #include "kocore.h" | 51 | #include "kocore.h" |
51 | #endif | 52 | #endif |
52 | #include "koglobals.h" | 53 | #include "koglobals.h" |
53 | #include <libkcal/kincidenceformatter.h> | 54 | #include <libkcal/kincidenceformatter.h> |
54 | 55 | ||
55 | #include "komonthview.h" | 56 | #include "komonthview.h" |
56 | 57 | ||
57 | #define PIXMAP_SIZE 5 | 58 | #define PIXMAP_SIZE 5 |
58 | #ifdef DESKTOP_VERSION | 59 | #ifdef DESKTOP_VERSION |
59 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; | 60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; |
60 | #endif | 61 | #endif |
61 | class KNOWhatsThis :public QWhatsThis | 62 | class KNOWhatsThis :public QWhatsThis |
62 | { | 63 | { |
63 | public: | 64 | public: |
64 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
65 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; | 66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; |
66 | 67 | ||
67 | protected: | 68 | protected: |
68 | virtual QString text( const QPoint& p) | 69 | virtual QString text( const QPoint& p) |
69 | { | 70 | { |
70 | return _wid->getWhatsThisText(p) ; | 71 | return _wid->getWhatsThisText(p) ; |
71 | }; | 72 | }; |
72 | private: | 73 | private: |
73 | KNoScrollListBox* _wid; | 74 | KNoScrollListBox* _wid; |
74 | 75 | ||
75 | }; | 76 | }; |
76 | 77 | ||
77 | 78 | ||
78 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
79 | : QListBox(parent, name, WRepaintNoErase) | 80 | : QListBox(parent, name, WRepaintNoErase) |
80 | { | 81 | { |
81 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
82 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
83 | #endif | 84 | #endif |
84 | mWT = new KNOWhatsThis(this); | 85 | mWT = new KNOWhatsThis(this); |
85 | } | 86 | } |
86 | KNoScrollListBox::~KNoScrollListBox() | 87 | KNoScrollListBox::~KNoScrollListBox() |
87 | { | 88 | { |
88 | 89 | ||
89 | } | 90 | } |
90 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
91 | { | 92 | { |
92 | QListBoxItem* item = itemAt ( p ); | 93 | QListBoxItem* item = itemAt ( p ); |
93 | if ( ! item ) { | 94 | if ( ! item ) { |
94 | return i18n("Click in the cell\nto add an event!"); | 95 | return i18n("Click in the cell\nto add an event!"); |
95 | } | 96 | } |
96 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); |
97 | } | 98 | } |
98 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 99 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
99 | { | 100 | { |
100 | 101 | ||
101 | switch(e->key()) { | 102 | switch(e->key()) { |
102 | case Key_Right: | 103 | case Key_Right: |
103 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 104 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
104 | { | 105 | { |
105 | e->ignore(); | 106 | e->ignore(); |
106 | return; | 107 | return; |
107 | } | 108 | } |
108 | scrollBy(10,0); | 109 | scrollBy(10,0); |
109 | break; | 110 | break; |
110 | case Key_Left: | 111 | case Key_Left: |
111 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 112 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
112 | { | 113 | { |
113 | e->ignore(); | 114 | e->ignore(); |
114 | return; | 115 | return; |
115 | } | 116 | } |
116 | scrollBy(-10,0); | 117 | scrollBy(-10,0); |
117 | break; | 118 | break; |
118 | case Key_Up: | 119 | case Key_Up: |
119 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 120 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
120 | e->ignore(); | 121 | e->ignore(); |
121 | break; | 122 | break; |
122 | } | 123 | } |
123 | setCurrentItem((currentItem()+count()-1)%count()); | 124 | setCurrentItem((currentItem()+count()-1)%count()); |
124 | if(!itemVisible(currentItem())) { | 125 | if(!itemVisible(currentItem())) { |
125 | if((unsigned int) currentItem() == (count()-1)) { | 126 | if((unsigned int) currentItem() == (count()-1)) { |
126 | setTopItem(currentItem()-numItemsVisible()+1); | 127 | setTopItem(currentItem()-numItemsVisible()+1); |
127 | } else { | 128 | } else { |
128 | setTopItem(topItem()-1); | 129 | setTopItem(topItem()-1); |
129 | } | 130 | } |
130 | } | 131 | } |
131 | break; | 132 | break; |
132 | case Key_Down: | 133 | case Key_Down: |
133 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 134 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
134 | e->ignore(); | 135 | e->ignore(); |
135 | break; | 136 | break; |
136 | } | 137 | } |
137 | setCurrentItem((currentItem()+1)%count()); | 138 | setCurrentItem((currentItem()+1)%count()); |
138 | if(!itemVisible(currentItem())) { | 139 | if(!itemVisible(currentItem())) { |
139 | if(currentItem() == 0) { | 140 | if(currentItem() == 0) { |
140 | setTopItem(0); | 141 | setTopItem(0); |
141 | } else { | 142 | } else { |
142 | setTopItem(topItem()+1); | 143 | setTopItem(topItem()+1); |
143 | } | 144 | } |
144 | } | 145 | } |
145 | break; | 146 | break; |
146 | case Key_I: | 147 | case Key_I: |
147 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); | 148 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); |
148 | e->ignore(); | 149 | e->ignore(); |
149 | break; | 150 | break; |
150 | case Key_Shift: | 151 | case Key_Shift: |
151 | emit shiftDown(); | 152 | emit shiftDown(); |
152 | break; | 153 | break; |
153 | default: | 154 | default: |
154 | e->ignore(); | 155 | e->ignore(); |
155 | break; | 156 | break; |
156 | } | 157 | } |
157 | } | 158 | } |
158 | 159 | ||
159 | void KNoScrollListBox::oneDown() | 160 | void KNoScrollListBox::oneDown() |
160 | { | 161 | { |
161 | setCurrentItem((currentItem()+1)%count()); | 162 | setCurrentItem((currentItem()+1)%count()); |
162 | if(!itemVisible(currentItem())) { | 163 | if(!itemVisible(currentItem())) { |
163 | if(currentItem() == 0) { | 164 | if(currentItem() == 0) { |
164 | setTopItem(0); | 165 | setTopItem(0); |
165 | } else { | 166 | } else { |
166 | setTopItem(topItem()+1); | 167 | setTopItem(topItem()+1); |
167 | } | 168 | } |
168 | } | 169 | } |
169 | } | 170 | } |
170 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 171 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
171 | { | 172 | { |
172 | switch(e->key()) { | 173 | switch(e->key()) { |
173 | case Key_Shift: | 174 | case Key_Shift: |
174 | emit shiftUp(); | 175 | emit shiftUp(); |
175 | break; | 176 | break; |
176 | default: | 177 | default: |
177 | break; | 178 | break; |
178 | } | 179 | } |
179 | } | 180 | } |
180 | 181 | ||
181 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 182 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
182 | { | 183 | { |
183 | QListBox::mousePressEvent(e); | 184 | QListBox::mousePressEvent(e); |
184 | 185 | ||
185 | if(e->button() == RightButton) { | 186 | if(e->button() == RightButton) { |
186 | emit rightClick(); | 187 | emit rightClick(); |
187 | } | 188 | } |
188 | } | 189 | } |
189 | 190 | ||
190 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 191 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
191 | : QListBoxItem() | 192 | : QListBoxItem() |
192 | { | 193 | { |
193 | setText( s ); | 194 | setText( s ); |
194 | 195 | ||
195 | mIncidence = incidence; | 196 | mIncidence = incidence; |
196 | mDate = qd; | 197 | mDate = qd; |
197 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 198 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
198 | mRecur = false; | 199 | mRecur = false; |
199 | mAlarm = false; | 200 | mAlarm = false; |
200 | mReply = false; | 201 | mReply = false; |
201 | mInfo = false; | 202 | mInfo = false; |
202 | } | 203 | } |
203 | 204 | ||
204 | void MonthViewItem::paint(QPainter *p) | 205 | void MonthViewItem::paint(QPainter *p) |
205 | { | 206 | { |
206 | #if QT_VERSION >= 0x030000 | 207 | #if QT_VERSION >= 0x030000 |
207 | bool sel = isSelected(); | 208 | bool sel = isSelected(); |
208 | #else | 209 | #else |
209 | bool sel = selected(); | 210 | bool sel = selected(); |
210 | #endif | 211 | #endif |
211 | 212 | ||
212 | 213 | ||
213 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 214 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
214 | { | 215 | { |
215 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 216 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
216 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 217 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
217 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 218 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
218 | } | 219 | } |
219 | int x = 1; | 220 | int x = 1; |
220 | int y = 3;//(height() - mRecurPixmap.height()) /2; | 221 | int y = 3;//(height() - mRecurPixmap.height()) /2; |
221 | int size = PIXMAP_SIZE; | 222 | int size = PIXMAP_SIZE; |
222 | if ( QApplication::desktop()->width() < 300 ) | 223 | if ( QApplication::desktop()->width() < 300 ) |
223 | size = 3; | 224 | size = 3; |
224 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 225 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
225 | if ( mInfo ) { | 226 | if ( mInfo ) { |
226 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 227 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
227 | x += size + 1; | 228 | x += size + 1; |
228 | } | 229 | } |
229 | if ( mRecur ) { | 230 | if ( mRecur ) { |
230 | p->fillRect ( x, y,size,size, Qt::blue ); | 231 | p->fillRect ( x, y,size,size, Qt::blue ); |
231 | x += size + 1; | 232 | x += size + 1; |
232 | } | 233 | } |
233 | if ( mAlarm ) { | 234 | if ( mAlarm ) { |
234 | p->fillRect ( x, y,size,size, Qt::red ); | 235 | p->fillRect ( x, y,size,size, Qt::red ); |
235 | x += size + 1; | 236 | x += size + 1; |
236 | } | 237 | } |
237 | if ( mReply ) { | 238 | if ( mReply ) { |
238 | p->fillRect ( x, y,size,size, Qt::yellow ); | 239 | p->fillRect ( x, y,size,size, Qt::yellow ); |
239 | x += size + 1; | 240 | x += size + 1; |
240 | } | 241 | } |
241 | } | 242 | } |
242 | QFontMetrics fm = p->fontMetrics(); | 243 | QFontMetrics fm = p->fontMetrics(); |
243 | int yPos; | 244 | int yPos; |
244 | int pmheight = size; | 245 | int pmheight = size; |
245 | if( pmheight < fm.height() ) | 246 | if( pmheight < fm.height() ) |
246 | yPos = fm.ascent() + fm.leading()/2; | 247 | yPos = fm.ascent() + fm.leading()/2; |
247 | else | 248 | else |
248 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 249 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
249 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 250 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
250 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 251 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
251 | p->drawText( x, yPos, text() ); | 252 | p->drawText( x, yPos, text() ); |
252 | if ( mIncidence->cancelled() ) { | 253 | if ( mIncidence->cancelled() ) { |
253 | int wid = fm.width( text() ); | 254 | int wid = fm.width( text() ); |
254 | p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); | 255 | p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); |
255 | } | 256 | } |
256 | 257 | ||
257 | } | 258 | } |
258 | 259 | ||
259 | int MonthViewItem::height(const QListBox *lb) const | 260 | int MonthViewItem::height(const QListBox *lb) const |
260 | { | 261 | { |
261 | return lb->fontMetrics().lineSpacing()+1; | 262 | return lb->fontMetrics().lineSpacing()+1; |
262 | } | 263 | } |
263 | 264 | ||
264 | int MonthViewItem::width(const QListBox *lb) const | 265 | int MonthViewItem::width(const QListBox *lb) const |
265 | { | 266 | { |
266 | int size = PIXMAP_SIZE; | 267 | int size = PIXMAP_SIZE; |
267 | if ( QApplication::desktop()->width() < 300 ) | 268 | if ( QApplication::desktop()->width() < 300 ) |
268 | size = 3; | 269 | size = 3; |
269 | int x = 1; | 270 | int x = 1; |
270 | if ( mInfo ) { | 271 | if ( mInfo ) { |
271 | x += size + 1; | 272 | x += size + 1; |
272 | } | 273 | } |
273 | if( mRecur ) { | 274 | if( mRecur ) { |
274 | x += size+1; | 275 | x += size+1; |
275 | } | 276 | } |
276 | if( mAlarm ) { | 277 | if( mAlarm ) { |
277 | x += size+1; | 278 | x += size+1; |
278 | } | 279 | } |
279 | if( mReply ) { | 280 | if( mReply ) { |
280 | x += size+1; | 281 | x += size+1; |
281 | } | 282 | } |
282 | 283 | ||
283 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 284 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
284 | } | 285 | } |
285 | 286 | ||
286 | 287 | ||
287 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 288 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
288 | : QWidget( par ), | 289 | : QWidget( par ), |
289 | mMonthView( parent ) | 290 | mMonthView( parent ) |
290 | { | 291 | { |
291 | 292 | ||
292 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 293 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
293 | 294 | ||
294 | // mLabel = new QLabel( this );QPushButton | 295 | // mLabel = new QLabel( this );QPushButton |
295 | mLabel = new QPushButton( this ); | 296 | mLabel = new QPushButton( this ); |
296 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 297 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
297 | //mLabel->setLineWidth( 1 ); | 298 | //mLabel->setLineWidth( 1 ); |
298 | //mLabel->setAlignment( AlignCenter ); | 299 | //mLabel->setAlignment( AlignCenter ); |
299 | mLabel->setFlat( true ); | 300 | mLabel->setFlat( true ); |
300 | mLabel->setFocusPolicy(NoFocus); | 301 | mLabel->setFocusPolicy(NoFocus); |
301 | mItemList = new KNoScrollListBox( this ); | 302 | mItemList = new KNoScrollListBox( this ); |
302 | mItemList->setMinimumSize( 10, 10 ); | 303 | mItemList->setMinimumSize( 10, 10 ); |
303 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 304 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
304 | mItemList->setLineWidth( 1 ); | 305 | mItemList->setLineWidth( 1 ); |
305 | topLayout->addWidget( mItemList ); | 306 | topLayout->addWidget( mItemList ); |
306 | mLabel->raise(); | 307 | mLabel->raise(); |
307 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 308 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
308 | mStandardPalette = palette(); | 309 | mStandardPalette = palette(); |
309 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 310 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
310 | 311 | ||
311 | enableScrollBars( false ); | 312 | enableScrollBars( false ); |
312 | updateConfig(); | 313 | updateConfig(); |
313 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 314 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
314 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 315 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
315 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 316 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), |
316 | SLOT( defaultAction( QListBoxItem * ) ) ); | 317 | SLOT( defaultAction( QListBoxItem * ) ) ); |
317 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 318 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, |
318 | const QPoint &) ), | 319 | const QPoint &) ), |
319 | SLOT( contextMenu( QListBoxItem * ) ) ); | 320 | SLOT( contextMenu( QListBoxItem * ) ) ); |
320 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 321 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), |
321 | SLOT( selection( QListBoxItem * ) ) ); | 322 | SLOT( selection( QListBoxItem * ) ) ); |
322 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 323 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
323 | SLOT( cellClicked( QListBoxItem * ) ) ); | 324 | SLOT( cellClicked( QListBoxItem * ) ) ); |
324 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 325 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
325 | SLOT( selection( QListBoxItem * ) ) ); | 326 | SLOT( selection( QListBoxItem * ) ) ); |
326 | } | 327 | } |
327 | #ifdef DESKTOP_VERSION | 328 | #ifdef DESKTOP_VERSION |
328 | QToolTipGroup *MonthViewCell::toolTipGroup() | 329 | QToolTipGroup *MonthViewCell::toolTipGroup() |
329 | { | 330 | { |
330 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 331 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
331 | return mToolTipGroup; | 332 | return mToolTipGroup; |
332 | } | 333 | } |
333 | #endif | 334 | #endif |
334 | 335 | ||
335 | void MonthViewCell::setDate( const QDate &date ) | 336 | void MonthViewCell::setDate( const QDate &date ) |
336 | { | 337 | { |
337 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 338 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
338 | mDate = date; | 339 | mDate = date; |
339 | 340 | ||
340 | 341 | ||
341 | 342 | ||
342 | //resizeEvent( 0 ); | 343 | //resizeEvent( 0 ); |
343 | } | 344 | } |
344 | 345 | ||
345 | QDate MonthViewCell::date() const | 346 | QDate MonthViewCell::date() const |
346 | { | 347 | { |
347 | return mDate; | 348 | return mDate; |
348 | } | 349 | } |
349 | 350 | ||
350 | void MonthViewCell::setPrimary( bool primary ) | 351 | void MonthViewCell::setPrimary( bool primary ) |
351 | { | 352 | { |
352 | mPrimary = primary; | 353 | mPrimary = primary; |
353 | //setMyPalette(); | 354 | //setMyPalette(); |
354 | } | 355 | } |
355 | void MonthViewCell::setMyPalette() | 356 | void MonthViewCell::setMyPalette() |
356 | { | 357 | { |
357 | 358 | ||
358 | if ( mHoliday) { | 359 | if ( mHoliday) { |
359 | setPalette( mHolidayPalette ); | 360 | setPalette( mHolidayPalette ); |
360 | } else { | 361 | } else { |
361 | if ( mPrimary ) { | 362 | if ( mPrimary ) { |
362 | setPalette( mPrimaryPalette ); | 363 | setPalette( mPrimaryPalette ); |
363 | } else { | 364 | } else { |
364 | setPalette( mNonPrimaryPalette ); | 365 | setPalette( mNonPrimaryPalette ); |
365 | } | 366 | } |
366 | } | 367 | } |
367 | QPalette pal = palette(); | 368 | QPalette pal = palette(); |
368 | 369 | ||
369 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 370 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
370 | } | 371 | } |
371 | QPalette MonthViewCell::getPalette () | 372 | QPalette MonthViewCell::getPalette () |
372 | { | 373 | { |
373 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 374 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
374 | return mStandardPalette; | 375 | return mStandardPalette; |
375 | if ( mHoliday) { | 376 | if ( mHoliday) { |
376 | return mHolidayPalette ; | 377 | return mHolidayPalette ; |
377 | } else { | 378 | } else { |
378 | if ( mPrimary ) { | 379 | if ( mPrimary ) { |
379 | return mPrimaryPalette ; | 380 | return mPrimaryPalette ; |
380 | } | 381 | } |
381 | } | 382 | } |
382 | return mNonPrimaryPalette; | 383 | return mNonPrimaryPalette; |
383 | } | 384 | } |
384 | bool MonthViewCell::isPrimary() const | 385 | bool MonthViewCell::isPrimary() const |
385 | { | 386 | { |
386 | return mPrimary; | 387 | return mPrimary; |
387 | } | 388 | } |
388 | 389 | ||
389 | void MonthViewCell::setHoliday( bool holiday ) | 390 | void MonthViewCell::setHoliday( bool holiday ) |
390 | { | 391 | { |
391 | mHoliday = holiday; | 392 | mHoliday = holiday; |
392 | //setMyPalette(); | 393 | //setMyPalette(); |
393 | } | 394 | } |
394 | 395 | ||
395 | void MonthViewCell::setHoliday( const QString &holiday ) | 396 | void MonthViewCell::setHoliday( const QString &holiday ) |
396 | { | 397 | { |
397 | mHolidayString = holiday; | 398 | mHolidayString = holiday; |
398 | 399 | ||
399 | if ( !holiday.isEmpty() ) { | 400 | if ( !holiday.isEmpty() ) { |
400 | setHoliday( true ); | 401 | setHoliday( true ); |
401 | } | 402 | } |
402 | } | 403 | } |
403 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 404 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
404 | { | 405 | { |
405 | 406 | ||
406 | e->ignore(); | 407 | e->ignore(); |
407 | 408 | ||
408 | } | 409 | } |
@@ -1 +1 @@ | |||
version = "2.0.3"; | version = "2.0.4"; | ||