-rw-r--r-- | korganizer/journalentry.cpp | 7 | ||||
-rw-r--r-- | korganizer/kojournalview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kojournalview.h | 1 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 6 |
5 files changed, 16 insertions, 5 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 395392c..3c01eeb 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -1,275 +1,276 @@ | |||
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 | #include <qapplication.h> |
37 | 37 | ||
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <kglobal.h> | 39 | #include <kglobal.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <ktextedit.h> | 41 | #include <ktextedit.h> |
42 | #include <kfiledialog.h> | 42 | #include <kfiledialog.h> |
43 | #include <kmessagebox.h> | 43 | #include <kmessagebox.h> |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #include <klineedit.h> | 45 | #include <klineedit.h> |
46 | 46 | ||
47 | #include <libkcal/journal.h> | 47 | #include <libkcal/journal.h> |
48 | #include <libkcal/calendarresources.h> | 48 | #include <libkcal/calendarresources.h> |
49 | #include <libkcal/resourcecalendar.h> | 49 | #include <libkcal/resourcecalendar.h> |
50 | #include <kresources/resourceselectdialog.h> | 50 | #include <kresources/resourceselectdialog.h> |
51 | 51 | ||
52 | #include "journalentry.h" | 52 | #include "journalentry.h" |
53 | //#include "journalentry.moc" | 53 | //#include "journalentry.moc" |
54 | #ifndef DESKTOP_VERSION | 54 | #ifndef DESKTOP_VERSION |
55 | #include <qpe/qpeapplication.h> | 55 | #include <qpe/qpeapplication.h> |
56 | #endif | 56 | #endif |
57 | JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | 57 | JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : |
58 | QFrame(parent) | 58 | QFrame(parent) |
59 | { | 59 | { |
60 | heiHint = QApplication::desktop()->height() / 5 ; | 60 | heiHint = QApplication::desktop()->height() / 5 ; |
61 | showOnlyMode = false; | 61 | showOnlyMode = false; |
62 | mCalendar = calendar; | 62 | mCalendar = calendar; |
63 | mJournal = 0; | 63 | mJournal = 0; |
64 | visibleMode = true; | 64 | visibleMode = true; |
65 | QHBox * vb = new QHBox ( this ); | 65 | QHBox * vb = new QHBox ( this ); |
66 | QPixmap iconp; | 66 | QPixmap iconp; |
67 | 67 | ||
68 | QPushButton * toggleJournal = new QPushButton( vb ); | 68 | QPushButton * toggleJournal = new QPushButton( vb ); |
69 | iconp = SmallIcon("1updownarrow"); | 69 | iconp = SmallIcon("1updownarrow"); |
70 | toggleJournal->setPixmap (iconp ) ; | 70 | toggleJournal->setPixmap (iconp ) ; |
71 | new QLabel(i18n(" Title: "),vb); | 71 | new QLabel(i18n(" Title: "),vb); |
72 | mTitle = new KLineEdit ( vb ); | 72 | mTitle = new KLineEdit ( vb ); |
73 | mTitleLabel = new QLabel(i18n("Title"),vb); | 73 | mTitleLabel = new QLabel(i18n("Title"),vb); |
74 | mTitleLabel->setMargin(0); | 74 | mTitleLabel->setMargin(0); |
75 | mTitleLabel->setAlignment(AlignCenter); | 75 | mTitleLabel->setAlignment(AlignCenter); |
76 | QPushButton * loadTemplate = new QPushButton( vb ); | 76 | QPushButton * loadTemplate = new QPushButton( vb ); |
77 | QPushButton * saveTemplate = new QPushButton( vb ); | 77 | QPushButton * saveTemplate = new QPushButton( vb ); |
78 | if ( QApplication::desktop()->width() < 321 ) | 78 | if ( QApplication::desktop()->width() < 321 ) |
79 | iconp = SmallIcon("fileexport16"); | 79 | iconp = SmallIcon("fileexport16"); |
80 | else | 80 | else |
81 | iconp = SmallIcon("fileexport"); | 81 | iconp = SmallIcon("fileexport"); |
82 | saveTemplate->setPixmap (iconp ) ; | 82 | saveTemplate->setPixmap (iconp ) ; |
83 | int size = saveTemplate->sizeHint().height(); | 83 | int size = saveTemplate->sizeHint().height(); |
84 | if ( QApplication::desktop()->width() < 321 ) | 84 | if ( QApplication::desktop()->width() < 321 ) |
85 | iconp = SmallIcon("fileimport16"); | 85 | iconp = SmallIcon("fileimport16"); |
86 | else | 86 | else |
87 | iconp = SmallIcon("fileimport"); | 87 | iconp = SmallIcon("fileimport"); |
88 | loadTemplate->setPixmap (iconp ) ; | 88 | loadTemplate->setPixmap (iconp ) ; |
89 | loadTemplate->setFixedSize( size, size ); | 89 | loadTemplate->setFixedSize( size, size ); |
90 | saveTemplate->setFixedSize( size, size ); | 90 | saveTemplate->setFixedSize( size, size ); |
91 | toggleJournal->setFixedSize( size , size ); | 91 | toggleJournal->setFixedSize( size , size ); |
92 | mEditor = new KTextEdit(this); | 92 | mEditor = new KTextEdit(this); |
93 | #ifndef DESKTOP_VERSION | 93 | #ifndef DESKTOP_VERSION |
94 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); | 94 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); |
95 | #endif | 95 | #endif |
96 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); | 96 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); |
97 | QBoxLayout *topLayout = new QVBoxLayout(this); | 97 | QBoxLayout *topLayout = new QVBoxLayout(this); |
98 | topLayout->addWidget(vb); | 98 | topLayout->addWidget(vb); |
99 | topLayout->addWidget(mEditor); | 99 | topLayout->addWidget(mEditor); |
100 | mEditor->installEventFilter(this); | 100 | mEditor->installEventFilter(this); |
101 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 101 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
102 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 102 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
103 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); | 103 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); |
104 | } | 104 | } |
105 | 105 | ||
106 | JournalEntry::~JournalEntry() | 106 | JournalEntry::~JournalEntry() |
107 | { | 107 | { |
108 | //qDebug("JournalEntry::~JournalEntry() "); | 108 | //qDebug("JournalEntry::~JournalEntry() "); |
109 | } | 109 | } |
110 | QSize JournalEntry::sizeHint() const | 110 | QSize JournalEntry::sizeHint() const |
111 | { | 111 | { |
112 | return QSize ( 240, heiHint ); | 112 | return QSize ( 240, heiHint ); |
113 | } | 113 | } |
114 | void JournalEntry::slotSaveTemplate() | 114 | void JournalEntry::slotSaveTemplate() |
115 | { | 115 | { |
116 | QString fileName =locateLocal( "templates", "journals" ); | 116 | QString fileName =locateLocal( "templates", "journals" ); |
117 | QDir t_dir; | 117 | QDir t_dir; |
118 | if ( !t_dir.exists(fileName) ) | 118 | if ( !t_dir.exists(fileName) ) |
119 | t_dir.mkdir ( fileName ); | 119 | t_dir.mkdir ( fileName ); |
120 | fileName += "/journal"; | 120 | fileName += "/journal"; |
121 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); | 121 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); |
122 | if ( fileName.length() == 0 ) | 122 | if ( fileName.length() == 0 ) |
123 | return; | 123 | return; |
124 | 124 | ||
125 | QFile fileIn( fileName ); | 125 | QFile fileIn( fileName ); |
126 | if (!fileIn.open( IO_WriteOnly ) ) { | 126 | if (!fileIn.open( IO_WriteOnly ) ) { |
127 | KMessageBox::error( this, i18n("Error saving template file\n '%1'.") | 127 | KMessageBox::error( this, i18n("Error saving template file\n '%1'.") |
128 | .arg( fileName ) ); | 128 | .arg( fileName ) ); |
129 | return; | 129 | return; |
130 | } | 130 | } |
131 | // QString text; | 131 | // QString text; |
132 | QTextStream tsIn( &fileIn ); | 132 | QTextStream tsIn( &fileIn ); |
133 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 133 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
134 | tsIn << mEditor->text(); | 134 | tsIn << mEditor->text(); |
135 | fileIn.close(); | 135 | fileIn.close(); |
136 | } | 136 | } |
137 | void JournalEntry::slotLoadTemplate() | 137 | void JournalEntry::slotLoadTemplate() |
138 | { | 138 | { |
139 | QString fileName =locateLocal( "templates", "journals" ); | 139 | QString fileName =locateLocal( "templates", "journals" ); |
140 | QDir t_dir; | 140 | QDir t_dir; |
141 | if ( !t_dir.exists(fileName) ) | 141 | if ( !t_dir.exists(fileName) ) |
142 | t_dir.mkdir ( fileName ); | 142 | t_dir.mkdir ( fileName ); |
143 | fileName += "/journal"; | 143 | fileName += "/journal"; |
144 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); | 144 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); |
145 | if ( fileName.length() == 0 ) | 145 | if ( fileName.length() == 0 ) |
146 | return; | 146 | return; |
147 | QFile fileIn( fileName ); | 147 | QFile fileIn( fileName ); |
148 | if (!fileIn.open( IO_ReadOnly ) ) { | 148 | if (!fileIn.open( IO_ReadOnly ) ) { |
149 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") | 149 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") |
150 | .arg( fileName ) ); | 150 | .arg( fileName ) ); |
151 | return; | 151 | return; |
152 | } | 152 | } |
153 | QTextStream tsIn( &fileIn ); | 153 | QTextStream tsIn( &fileIn ); |
154 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 154 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
155 | QString text = tsIn.read(); | 155 | QString text = tsIn.read(); |
156 | fileIn.close(); | 156 | fileIn.close(); |
157 | int line, col; | 157 | int line, col; |
158 | mEditor->getCursorPosition (& line, & col ); | 158 | mEditor->getCursorPosition (& line, & col ); |
159 | mEditor-> insertAt ( text, line, col, true ); | 159 | mEditor-> insertAt ( text, line, col, true ); |
160 | //mEditor->setIgnoreMark( true ); | 160 | //mEditor->setIgnoreMark( true ); |
161 | } | 161 | } |
162 | void JournalEntry::setDate(const QDate &date) | 162 | void JournalEntry::setDate(const QDate &date) |
163 | { | 163 | { |
164 | showOnlyMode = false; | 164 | showOnlyMode = false; |
165 | mDate = date; | 165 | mDate = date; |
166 | writeJournal(); | 166 | writeJournal(); |
167 | int id = mCalendar->defaultCalendar(); | 167 | int id = mCalendar->defaultCalendar(); |
168 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; | 168 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; |
169 | mTitleLabel->setText( " (" + calname +")"); | 169 | mTitleLabel->setText( " (" + calname +")"); |
170 | } | 170 | } |
171 | 171 | ||
172 | void JournalEntry::toggleShowJournal() | 172 | void JournalEntry::toggleShowJournal() |
173 | { | 173 | { |
174 | if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty()) | 174 | if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty()) |
175 | flushEntry(); | 175 | flushEntry(); |
176 | if ( showOnlyMode ) | 176 | if ( showOnlyMode ) |
177 | emit showJournalOnly( 0 ); | 177 | emit showJournalOnly( 0 ); |
178 | else { | 178 | else { |
179 | // we have to protect mJournal from deleting if mJournal has empty text | 179 | // we have to protect mJournal from deleting if mJournal has empty text |
180 | visibleMode = false; // set to true via :setShowOnly() | 180 | visibleMode = false; // set to true via :setShowOnly() |
181 | emit showJournalOnly( mJournal ); | 181 | emit showJournalOnly( mJournal ); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | void JournalEntry::setShowOnly() | 184 | void JournalEntry::setShowOnly() |
185 | { | 185 | { |
186 | showOnlyMode = true; | 186 | showOnlyMode = true; |
187 | mEditor->setFocus(); | 187 | mEditor->setFocus(); |
188 | visibleMode = true; | 188 | visibleMode = true; |
189 | } | 189 | } |
190 | void JournalEntry::setJournal(Journal *journal) | 190 | void JournalEntry::setJournal(Journal *journal) |
191 | { | 191 | { |
192 | writeJournal(); | 192 | writeJournal(); |
193 | 193 | ||
194 | mJournal = journal; | 194 | mJournal = journal; |
195 | if ( journal->isReadOnly() ) | 195 | if ( journal->isReadOnly() ) |
196 | mTitle->setText(mJournal->summary()+" ("+i18n("readonly")+")"); | 196 | mTitle->setText(mJournal->summary()+" ("+i18n("readonly")+")"); |
197 | else | 197 | else |
198 | mTitle->setText(mJournal->summary()); | 198 | mTitle->setText(mJournal->summary()); |
199 | mEditor->setText(mJournal->description()); | 199 | mEditor->setText(mJournal->description()); |
200 | mTitle->setReadOnly (journal->isReadOnly() ); | 200 | mTitle->setReadOnly (journal->isReadOnly() ); |
201 | mEditor->setReadOnly ( journal->isReadOnly() ); | 201 | mEditor->setReadOnly ( journal->isReadOnly() ); |
202 | int id = mJournal->calID(); | 202 | int id = mJournal->calID(); |
203 | 203 | ||
204 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; | 204 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; |
205 | mTitleLabel->setText( " (" + calname +")"); | 205 | mTitleLabel->setText( " (" + calname +")"); |
206 | 206 | ||
207 | } | 207 | } |
208 | 208 | ||
209 | Journal *JournalEntry::journal() const | 209 | Journal *JournalEntry::journal() const |
210 | { | 210 | { |
211 | return mJournal; | 211 | return mJournal; |
212 | } | 212 | } |
213 | 213 | ||
214 | 214 | ||
215 | void JournalEntry::clear() | 215 | void JournalEntry::clear() |
216 | { | 216 | { |
217 | mJournal = 0; | 217 | mJournal = 0; |
218 | mEditor->setText(""); | 218 | mEditor->setText(""); |
219 | mTitle->setText(""); | 219 | mTitle->setText(""); |
220 | } | 220 | } |
221 | 221 | ||
222 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) | 222 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) |
223 | { | 223 | { |
224 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; | 224 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; |
225 | 225 | ||
226 | if ( e->type() == QEvent::FocusOut ) { | 226 | if ( e->type() == QEvent::FocusOut ) { |
227 | writeJournal(); | 227 | writeJournal(); |
228 | } | 228 | } |
229 | if ( e->type() == QEvent::KeyPress ) { | 229 | if ( e->type() == QEvent::KeyPress ) { |
230 | QKeyEvent * k = (QKeyEvent *) e; | 230 | QKeyEvent * k = (QKeyEvent *) e; |
231 | if ( k->state() == Qt::ControlButton ) { | 231 | if ( k->state() == Qt::ControlButton ) { |
232 | k->ignore(); | 232 | k->ignore(); |
233 | //return true; | 233 | //return true; |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | return QFrame::eventFilter( o, e ); // standard event processing | 237 | return QFrame::eventFilter( o, e ); // standard event processing |
238 | } | 238 | } |
239 | 239 | ||
240 | void JournalEntry::writeJournal() | 240 | void JournalEntry::writeJournal() |
241 | { | 241 | { |
242 | if ( !visibleMode ) return; | 242 | if ( !visibleMode ) return; |
243 | if (mEditor->text().isEmpty() && mTitle->text().isEmpty()) { | 243 | if (mEditor->text().isEmpty() && mTitle->text().isEmpty()) { |
244 | if ( mJournal ) { | 244 | if ( mJournal ) { |
245 | Journal* j = mJournal; | 245 | Journal* j = mJournal; |
246 | mJournal = 0; | 246 | mJournal = 0; |
247 | bool conf = KOPrefs::instance()->mConfirm; | 247 | bool conf = KOPrefs::instance()->mConfirm; |
248 | KOPrefs::instance()->mConfirm = false; | 248 | KOPrefs::instance()->mConfirm = false; |
249 | emit deleteJournal(j); | 249 | emit deleteJournal(j); |
250 | KOPrefs::instance()->mConfirm = conf; | 250 | KOPrefs::instance()->mConfirm = conf; |
251 | } | 251 | } |
252 | return; | 252 | return; |
253 | } | 253 | } |
254 | 254 | ||
255 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; | 255 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; |
256 | 256 | ||
257 | if (!mJournal) { | 257 | if (!mJournal) { |
258 | mJournal = new Journal; | 258 | mJournal = new Journal; |
259 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); | 259 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); |
260 | mCalendar->addJournal(mJournal); | 260 | mCalendar->addJournal(mJournal); |
261 | } | 261 | } |
262 | 262 | if ( mJournal->description() != mEditor->text() ) | |
263 | mJournal->setDescription(mEditor->text()); | 263 | mJournal->setDescription(mEditor->text()); |
264 | mJournal->setSummary(mTitle->text()); | 264 | if ( mJournal->summary() != mTitle->text() ) |
265 | mJournal->setSummary(mTitle->text()); | ||
265 | } | 266 | } |
266 | 267 | ||
267 | void JournalEntry::flushEntry() | 268 | void JournalEntry::flushEntry() |
268 | { | 269 | { |
269 | writeJournal(); | 270 | writeJournal(); |
270 | } | 271 | } |
271 | void JournalEntry::keyPressEvent ( QKeyEvent * e ) | 272 | void JournalEntry::keyPressEvent ( QKeyEvent * e ) |
272 | { | 273 | { |
273 | e->ignore(); | 274 | e->ignore(); |
274 | 275 | ||
275 | } | 276 | } |
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index b659d53..51ae0a0 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp | |||
@@ -1,232 +1,236 @@ | |||
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 | // View of Journal entries | 25 | // View of Journal entries |
26 | 26 | ||
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qscrollview.h> | 28 | #include <qscrollview.h> |
29 | #include <qpopupmenu.h> | 29 | #include <qpopupmenu.h> |
30 | #include <qhbox.h> | 30 | #include <qhbox.h> |
31 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
32 | #include <qlabel.h> | 32 | #include <qlabel.h> |
33 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | 35 | ||
36 | #include <klocale.h> | 36 | #include <klocale.h> |
37 | #include <kdebug.h> | 37 | #include <kdebug.h> |
38 | #include "koprefs.h" | 38 | #include "koprefs.h" |
39 | #include <kglobal.h> | 39 | #include <kglobal.h> |
40 | 40 | ||
41 | #include <libkcal/calendar.h> | 41 | #include <libkcal/calendar.h> |
42 | 42 | ||
43 | #include "journalentry.h" | 43 | #include "journalentry.h" |
44 | 44 | ||
45 | #include "kojournalview.h" | 45 | #include "kojournalview.h" |
46 | using namespace KOrg; | 46 | using namespace KOrg; |
47 | 47 | ||
48 | KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, | 48 | KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, |
49 | const char *name) | 49 | const char *name) |
50 | : KOrg::BaseView(calendar, parent, name) | 50 | : KOrg::BaseView(calendar, parent, name) |
51 | { | 51 | { |
52 | mCalendar = calendar; | 52 | mCalendar = calendar; |
53 | QScrollView * sv = new QScrollView( this ); | 53 | QScrollView * sv = new QScrollView( this ); |
54 | QHBoxLayout * hbl = new QHBoxLayout( this ); | 54 | QHBoxLayout * hbl = new QHBoxLayout( this ); |
55 | hbl->addWidget( sv ); | 55 | hbl->addWidget( sv ); |
56 | parWid = new QWidget( sv->viewport() ); | 56 | parWid = new QWidget( sv->viewport() ); |
57 | sv->addChild(parWid); | 57 | sv->addChild(parWid); |
58 | sv->setResizePolicy( QScrollView:: AutoOneFit ); | 58 | sv->setResizePolicy( QScrollView:: AutoOneFit ); |
59 | mTopLayout = new QVBoxLayout(parWid); | 59 | mTopLayout = new QVBoxLayout(parWid); |
60 | QHBox * vb = new QHBox ( parWid ); | 60 | QHBox * vb = new QHBox ( parWid ); |
61 | QPushButton * newJournal = new QPushButton( vb ); | 61 | QPushButton * newJournal = new QPushButton( vb ); |
62 | QPixmap icon; | 62 | QPixmap icon; |
63 | if ( QApplication::desktop()->width() < 321 ) | 63 | if ( QApplication::desktop()->width() < 321 ) |
64 | icon = SmallIcon("ko16old"); | 64 | icon = SmallIcon("ko16old"); |
65 | else | 65 | else |
66 | icon = SmallIcon("ko24old"); | 66 | icon = SmallIcon("ko24old"); |
67 | newJournal->setPixmap (icon ) ; | 67 | newJournal->setPixmap (icon ) ; |
68 | int size = newJournal->sizeHint().height(); | 68 | int size = newJournal->sizeHint().height(); |
69 | newJournal->setFixedSize( size, size ); | 69 | newJournal->setFixedSize( size, size ); |
70 | mDateLabel = new QLabel ( vb ); | 70 | mDateLabel = new QLabel ( vb ); |
71 | mTopLayout->addWidget( vb ); | 71 | mTopLayout->addWidget( vb ); |
72 | mDateLabel->setMargin(1); | 72 | mDateLabel->setMargin(1); |
73 | mDateLabel->setAlignment(AlignCenter); | 73 | mDateLabel->setAlignment(AlignCenter); |
74 | connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) ); | 74 | connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) ); |
75 | getNewEntry(); | 75 | getNewEntry(); |
76 | } | 76 | } |
77 | 77 | ||
78 | KOJournalView::~KOJournalView() | 78 | KOJournalView::~KOJournalView() |
79 | { | 79 | { |
80 | } | 80 | } |
81 | 81 | ||
82 | int KOJournalView::currentDateCount() | 82 | int KOJournalView::currentDateCount() |
83 | { | 83 | { |
84 | return 0; | 84 | return 0; |
85 | } | 85 | } |
86 | JournalEntry* KOJournalView::getNewEntry() | 86 | JournalEntry* KOJournalView::getNewEntry() |
87 | { | 87 | { |
88 | JournalEntry* Entry = new JournalEntry(mCalendar,parWid); | 88 | JournalEntry* Entry = new JournalEntry(mCalendar,parWid); |
89 | jEntries.append( Entry ); | 89 | jEntries.append( Entry ); |
90 | mTopLayout->addWidget(Entry); | 90 | mTopLayout->addWidget(Entry); |
91 | Entry->setFont ( KOPrefs::instance()->mJornalViewFont ); | 91 | Entry->setFont ( KOPrefs::instance()->mJornalViewFont ); |
92 | connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; | 92 | connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; |
93 | connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ; | 93 | connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ; |
94 | connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ; | 94 | connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ; |
95 | return Entry; | 95 | return Entry; |
96 | } | 96 | } |
97 | 97 | ||
98 | QPtrList<Incidence> KOJournalView::selectedIncidences() | 98 | QPtrList<Incidence> KOJournalView::selectedIncidences() |
99 | { | 99 | { |
100 | QPtrList<Incidence> eventList; | 100 | QPtrList<Incidence> eventList; |
101 | 101 | ||
102 | return eventList; | 102 | return eventList; |
103 | } | 103 | } |
104 | void KOJournalView::updateConfig() | 104 | void KOJournalView::updateConfig() |
105 | { | 105 | { |
106 | JournalEntry* mEntry = jEntries.first(); | 106 | JournalEntry* mEntry = jEntries.first(); |
107 | while ( mEntry ) { | 107 | while ( mEntry ) { |
108 | mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); | 108 | mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); |
109 | mEntry = jEntries.next(); | 109 | mEntry = jEntries.next(); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | void KOJournalView::updateView() | 112 | void KOJournalView::updateView() |
113 | { | 113 | { |
114 | JournalEntry* mEntry = jEntries.first(); | 114 | JournalEntry* mEntry = jEntries.first(); |
115 | while ( mEntry ) { | 115 | while ( mEntry ) { |
116 | mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); | 116 | mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); |
117 | mEntry = jEntries.next(); | 117 | mEntry = jEntries.next(); |
118 | } | 118 | } |
119 | showDates( mDate, QDate() ); | 119 | showDates( mDate, QDate() ); |
120 | } | 120 | } |
121 | 121 | void KOJournalView::checkModified() | |
122 | { | ||
123 | qDebug("checkmod "); | ||
124 | flushView(); | ||
125 | } | ||
122 | void KOJournalView::flushView() | 126 | void KOJournalView::flushView() |
123 | { | 127 | { |
124 | static bool ff = false; | 128 | static bool ff = false; |
125 | if ( ff ) return; | 129 | if ( ff ) return; |
126 | ff = true; | 130 | ff = true; |
127 | JournalEntry* mEntry = jEntries.first(); | 131 | JournalEntry* mEntry = jEntries.first(); |
128 | while ( mEntry ) { | 132 | while ( mEntry ) { |
129 | mEntry->flushEntry(); | 133 | mEntry->flushEntry(); |
130 | mEntry = jEntries.next(); | 134 | mEntry = jEntries.next(); |
131 | } | 135 | } |
132 | ff = false; | 136 | ff = false; |
133 | } | 137 | } |
134 | 138 | ||
135 | void KOJournalView::clearList() | 139 | void KOJournalView::clearList() |
136 | { | 140 | { |
137 | JournalEntry* mEntry = jEntries.first(); | 141 | JournalEntry* mEntry = jEntries.first(); |
138 | while ( mEntry ) { | 142 | while ( mEntry ) { |
139 | mEntry->clear(); | 143 | mEntry->clear(); |
140 | mEntry = jEntries.next(); | 144 | mEntry = jEntries.next(); |
141 | } | 145 | } |
142 | } | 146 | } |
143 | void KOJournalView::newJournal() | 147 | void KOJournalView::newJournal() |
144 | { | 148 | { |
145 | //qDebug(" KOJournalView::newJournal()"); | 149 | //qDebug(" KOJournalView::newJournal()"); |
146 | flushView(); | 150 | flushView(); |
147 | Journal* mJournal = new Journal; | 151 | Journal* mJournal = new Journal; |
148 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); | 152 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); |
149 | mCalendar->addJournal(mJournal); | 153 | mCalendar->addJournal(mJournal); |
150 | showDates( mDate, QDate() ); | 154 | showDates( mDate, QDate() ); |
151 | } | 155 | } |
152 | 156 | ||
153 | void KOJournalView::showOnly ( Journal* j ) | 157 | void KOJournalView::showOnly ( Journal* j ) |
154 | { | 158 | { |
155 | //qDebug("showOnly %x ", j); | 159 | //qDebug("showOnly %x ", j); |
156 | flushView(); | 160 | flushView(); |
157 | if ( j == 0 ) { | 161 | if ( j == 0 ) { |
158 | showDates( mDate, QDate() ); | 162 | showDates( mDate, QDate() ); |
159 | return; | 163 | return; |
160 | } | 164 | } |
161 | QPtrList<Journal> jl; | 165 | QPtrList<Journal> jl; |
162 | jl.append ( j ); | 166 | jl.append ( j ); |
163 | showList( jl ); | 167 | showList( jl ); |
164 | JournalEntry* mEntry = jEntries.first(); | 168 | JournalEntry* mEntry = jEntries.first(); |
165 | mEntry->setShowOnly(); | 169 | mEntry->setShowOnly(); |
166 | } | 170 | } |
167 | void KOJournalView::showList(QPtrList<Journal> jl) | 171 | void KOJournalView::showList(QPtrList<Journal> jl) |
168 | { | 172 | { |
169 | //qDebug("KOJournalView::showList %d",jl.count() ); | 173 | //qDebug("KOJournalView::showList %d",jl.count() ); |
170 | JournalEntry* mEntry = jEntries.first(); | 174 | JournalEntry* mEntry = jEntries.first(); |
171 | JournalEntry* firstEntry = mEntry; | 175 | JournalEntry* firstEntry = mEntry; |
172 | int count = jl.count(); | 176 | int count = jl.count(); |
173 | int iii = 0; | 177 | int iii = 0; |
174 | while ( iii < count ) { | 178 | while ( iii < count ) { |
175 | if ( !mEntry ) { | 179 | if ( !mEntry ) { |
176 | mEntry = getNewEntry(); | 180 | mEntry = getNewEntry(); |
177 | mEntry->show(); | 181 | mEntry->show(); |
178 | mEntry->setVisibleMode( true ); | 182 | mEntry->setVisibleMode( true ); |
179 | mEntry->setDate(mDate); | 183 | mEntry->setDate(mDate); |
180 | mEntry->setJournal(jl.at(iii)); | 184 | mEntry->setJournal(jl.at(iii)); |
181 | mEntry = 0; | 185 | mEntry = 0; |
182 | } else { | 186 | } else { |
183 | mEntry->setDate(mDate); | 187 | mEntry->setDate(mDate); |
184 | mEntry->setJournal(jl.at(iii)); | 188 | mEntry->setJournal(jl.at(iii)); |
185 | mEntry->show(); | 189 | mEntry->show(); |
186 | mEntry->setVisibleMode( true ); | 190 | mEntry->setVisibleMode( true ); |
187 | mEntry = jEntries.next(); | 191 | mEntry = jEntries.next(); |
188 | } | 192 | } |
189 | ++iii; | 193 | ++iii; |
190 | } | 194 | } |
191 | while ( mEntry ) { | 195 | while ( mEntry ) { |
192 | mEntry->setDate(mDate); | 196 | mEntry->setDate(mDate); |
193 | mEntry->clear(); | 197 | mEntry->clear(); |
194 | if ( mEntry != firstEntry ) { | 198 | if ( mEntry != firstEntry ) { |
195 | mEntry->hide(); | 199 | mEntry->hide(); |
196 | mEntry->setVisibleMode( false ); | 200 | mEntry->setVisibleMode( false ); |
197 | } | 201 | } |
198 | else { | 202 | else { |
199 | mEntry->setVisibleMode( true ); | 203 | mEntry->setVisibleMode( true ); |
200 | mEntry->show(); | 204 | mEntry->show(); |
201 | } | 205 | } |
202 | mEntry = jEntries.next(); | 206 | mEntry = jEntries.next(); |
203 | } | 207 | } |
204 | } | 208 | } |
205 | 209 | ||
206 | void KOJournalView::showDates(const QDate &start, const QDate &) | 210 | void KOJournalView::showDates(const QDate &start, const QDate &) |
207 | { | 211 | { |
208 | mDate = start; | 212 | mDate = start; |
209 | mDateLabel-> setText(KGlobal::locale()->formatDate(mDate)); | 213 | mDateLabel-> setText(KGlobal::locale()->formatDate(mDate)); |
210 | QPtrList<Journal> jl = calendar()->journals4Date( start ); | 214 | QPtrList<Journal> jl = calendar()->journals4Date( start ); |
211 | showList( jl ); | 215 | showList( jl ); |
212 | } | 216 | } |
213 | 217 | ||
214 | void KOJournalView::showEvents(QPtrList<Event>) | 218 | void KOJournalView::showEvents(QPtrList<Event>) |
215 | { | 219 | { |
216 | // After new creation of list view no events are selected. | 220 | // After new creation of list view no events are selected. |
217 | // emit incidenceSelected( 0 ); | 221 | // emit incidenceSelected( 0 ); |
218 | } | 222 | } |
219 | 223 | ||
220 | void KOJournalView::changeEventDisplay(Event *, int /*action*/) | 224 | void KOJournalView::changeEventDisplay(Event *, int /*action*/) |
221 | { | 225 | { |
222 | updateView(); | 226 | updateView(); |
223 | } | 227 | } |
224 | 228 | ||
225 | void KOJournalView::keyPressEvent ( QKeyEvent * e ) | 229 | void KOJournalView::keyPressEvent ( QKeyEvent * e ) |
226 | { | 230 | { |
227 | //qDebug("keyPressEven "); | 231 | //qDebug("keyPressEven "); |
228 | if ( e->state() == Qt::ControlButton ) { | 232 | if ( e->state() == Qt::ControlButton ) { |
229 | if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left ) | 233 | if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left ) |
230 | e->ignore(); | 234 | e->ignore(); |
231 | } | 235 | } |
232 | } | 236 | } |
diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h index 331bdfa..7fa94ae 100644 --- a/korganizer/kojournalview.h +++ b/korganizer/kojournalview.h | |||
@@ -1,79 +1,80 @@ | |||
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 | #ifndef _KOJOURNALVIEW_H | 23 | #ifndef _KOJOURNALVIEW_H |
24 | #define _KOJOURNALVIEW_H | 24 | #define _KOJOURNALVIEW_H |
25 | 25 | ||
26 | #include <korganizer/baseview.h> | 26 | #include <korganizer/baseview.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | 28 | ||
29 | class JournalEntry; | 29 | class JournalEntry; |
30 | class QLabel; | 30 | class QLabel; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * This class provides a journal view. | 33 | * This class provides a journal view. |
34 | 34 | ||
35 | * @short View for Journal components. | 35 | * @short View for Journal components. |
36 | * @author Cornelius Schumacher <schumacher@kde.org> | 36 | * @author Cornelius Schumacher <schumacher@kde.org> |
37 | * @see KOBaseView | 37 | * @see KOBaseView |
38 | */ | 38 | */ |
39 | class KOJournalView : public KOrg::BaseView | 39 | class KOJournalView : public KOrg::BaseView |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | public: | 42 | public: |
43 | KOJournalView(Calendar *calendar, QWidget *parent = 0, | 43 | KOJournalView(Calendar *calendar, QWidget *parent = 0, |
44 | const char *name = 0); | 44 | const char *name = 0); |
45 | ~KOJournalView(); | 45 | ~KOJournalView(); |
46 | 46 | ||
47 | virtual int currentDateCount(); | 47 | virtual int currentDateCount(); |
48 | void clearList(); | 48 | void clearList(); |
49 | virtual QPtrList<Incidence> selectedIncidences(); | 49 | virtual QPtrList<Incidence> selectedIncidences(); |
50 | DateList selectedDates() | 50 | DateList selectedDates() |
51 | {DateList q; | 51 | {DateList q; |
52 | return q;}; | 52 | return q;}; |
53 | void checkModified(); | ||
53 | signals: | 54 | signals: |
54 | void deleteJournal(Journal *); | 55 | void deleteJournal(Journal *); |
55 | public slots: | 56 | public slots: |
56 | void showOnly ( Journal* ); | 57 | void showOnly ( Journal* ); |
57 | void newJournal(); | 58 | void newJournal(); |
58 | void updateView(); | 59 | void updateView(); |
59 | void flushView(); | 60 | void flushView(); |
60 | void updateConfig(); | 61 | void updateConfig(); |
61 | void showDates( const QDate &start, const QDate &end ); | 62 | void showDates( const QDate &start, const QDate &end ); |
62 | void showEvents(QPtrList<Event> eventList); | 63 | void showEvents(QPtrList<Event> eventList); |
63 | 64 | ||
64 | void changeEventDisplay(Event *, int); | 65 | void changeEventDisplay(Event *, int); |
65 | 66 | ||
66 | private: | 67 | private: |
67 | void showList(QPtrList<Journal> jl); | 68 | void showList(QPtrList<Journal> jl); |
68 | Calendar *mCalendar; | 69 | Calendar *mCalendar; |
69 | JournalEntry* getNewEntry(); | 70 | JournalEntry* getNewEntry(); |
70 | QPtrList<JournalEntry> jEntries; | 71 | QPtrList<JournalEntry> jEntries; |
71 | void keyPressEvent ( QKeyEvent * ) ; | 72 | void keyPressEvent ( QKeyEvent * ) ; |
72 | QBoxLayout *mTopLayout; | 73 | QBoxLayout *mTopLayout; |
73 | QWidget *parWid; | 74 | QWidget *parWid; |
74 | QLabel * mDateLabel; | 75 | QLabel * mDateLabel; |
75 | QDate mDate; | 76 | QDate mDate; |
76 | 77 | ||
77 | }; | 78 | }; |
78 | 79 | ||
79 | #endif | 80 | #endif |
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index d5a8e3b..2e6aaed 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h | |||
@@ -1,128 +1,129 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 | 3 | Copyright (c) 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef KOVIEWMANAGER_H | 24 | #ifndef KOVIEWMANAGER_H |
25 | #define KOVIEWMANAGER_H | 25 | #define KOVIEWMANAGER_H |
26 | 26 | ||
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | 28 | ||
29 | #include <korganizer/baseview.h> | 29 | #include <korganizer/baseview.h> |
30 | 30 | ||
31 | class CalendarView; | 31 | class CalendarView; |
32 | 32 | ||
33 | class KOListView; | 33 | class KOListView; |
34 | class KOAgendaView; | 34 | class KOAgendaView; |
35 | class KOMonthView; | 35 | class KOMonthView; |
36 | class KOTimeSpanView; | 36 | class KOTimeSpanView; |
37 | class KOTodoView; | 37 | class KOTodoView; |
38 | class KOWhatsNextView; | 38 | class KOWhatsNextView; |
39 | class KOJournalView; | 39 | class KOJournalView; |
40 | 40 | ||
41 | using namespace KCal; | 41 | using namespace KCal; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | This class manages the views of the calendar. It owns the objects and handles | 44 | This class manages the views of the calendar. It owns the objects and handles |
45 | creation and selection. | 45 | creation and selection. |
46 | */ | 46 | */ |
47 | class KOViewManager : public QObject | 47 | class KOViewManager : public QObject |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | KOViewManager( CalendarView * ); | 51 | KOViewManager( CalendarView * ); |
52 | virtual ~KOViewManager(); | 52 | virtual ~KOViewManager(); |
53 | 53 | ||
54 | /** changes the view to be the currently selected view */ | 54 | /** changes the view to be the currently selected view */ |
55 | void showView(KOrg::BaseView *, bool fullScreen = false ); | 55 | void showView(KOrg::BaseView *, bool fullScreen = false ); |
56 | void updateWNview(); | 56 | void updateWNview(); |
57 | void readSettings(KConfig *config); | 57 | void readSettings(KConfig *config); |
58 | void writeSettings(KConfig *config); | 58 | void writeSettings(KConfig *config); |
59 | bool showsNextDays(); | 59 | bool showsNextDays(); |
60 | /** Read which view was shown last from config file */ | 60 | /** Read which view was shown last from config file */ |
61 | void readCurrentView(KConfig *); | 61 | void readCurrentView(KConfig *); |
62 | /** Write which view is currently shown to config file */ | 62 | /** Write which view is currently shown to config file */ |
63 | void writeCurrentView(KConfig *); | 63 | void writeCurrentView(KConfig *); |
64 | 64 | ||
65 | KOrg::BaseView *currentView(); | 65 | KOrg::BaseView *currentView(); |
66 | 66 | ||
67 | void setDocumentId( const QString & ); | 67 | void setDocumentId( const QString & ); |
68 | 68 | ||
69 | void updateView( const QDate &start, const QDate &end ); | 69 | void updateView( const QDate &start, const QDate &end ); |
70 | void clearAllViews(); | 70 | void clearAllViews(); |
71 | 71 | ||
72 | void raiseCurrentView( bool fullScreen = false , bool updateView = false); | 72 | void raiseCurrentView( bool fullScreen = false , bool updateView = false); |
73 | 73 | ||
74 | void addView(KOrg::BaseView *); | 74 | void addView(KOrg::BaseView *); |
75 | 75 | ||
76 | Incidence *currentSelection(); | 76 | Incidence *currentSelection(); |
77 | QDate currentSelectionDate(); | 77 | QDate currentSelectionDate(); |
78 | 78 | ||
79 | KOAgendaView *agendaView() const { return mAgendaView; } | 79 | KOAgendaView *agendaView() const { return mAgendaView; } |
80 | KOJournalView *journalView() const { return mJournalView; } | ||
80 | 81 | ||
81 | signals: | 82 | signals: |
82 | void printWNV(); | 83 | void printWNV(); |
83 | void signalFullScreen( bool ); | 84 | void signalFullScreen( bool ); |
84 | void signalAgendaView( bool ); | 85 | void signalAgendaView( bool ); |
85 | public slots: | 86 | public slots: |
86 | void setDefaultCalendar(int); | 87 | void setDefaultCalendar(int); |
87 | void slotprintWNV(); | 88 | void slotprintWNV(); |
88 | void showNextView(); | 89 | void showNextView(); |
89 | void showMonth( const QDate & ); | 90 | void showMonth( const QDate & ); |
90 | void showDateView( int, QDate ); | 91 | void showDateView( int, QDate ); |
91 | void updateView(); | 92 | void updateView(); |
92 | void showWhatsNextView(); | 93 | void showWhatsNextView(); |
93 | void showListView(); | 94 | void showListView(); |
94 | void showAgendaView( bool fullScreen = false ); | 95 | void showAgendaView( bool fullScreen = false ); |
95 | void showDayView(); | 96 | void showDayView(); |
96 | void showWorkWeekView(); | 97 | void showWorkWeekView(); |
97 | void showWeekView(); | 98 | void showWeekView(); |
98 | void showNextXView(); | 99 | void showNextXView(); |
99 | void showMonthView(); | 100 | void showMonthView(); |
100 | void showMonthViewWeek(); | 101 | void showMonthViewWeek(); |
101 | void showTodoView(); | 102 | void showTodoView(); |
102 | void showJournalView(); | 103 | void showJournalView(); |
103 | void showTimeSpanView(); | 104 | void showTimeSpanView(); |
104 | 105 | ||
105 | private: | 106 | private: |
106 | void resetDateSilent( QDate date , int days ); | 107 | void resetDateSilent( QDate date , int days ); |
107 | int flagResetViewChangeDate; | 108 | int flagResetViewChangeDate; |
108 | QDate currentViewChangeDate; | 109 | QDate currentViewChangeDate; |
109 | void createMonthView(); | 110 | void createMonthView(); |
110 | CalendarView *mMainView; | 111 | CalendarView *mMainView; |
111 | 112 | ||
112 | int mCurrentAgendaView; | 113 | int mCurrentAgendaView; |
113 | KOAgendaView *mAgendaView; | 114 | KOAgendaView *mAgendaView; |
114 | KOListView *mListView; | 115 | KOListView *mListView; |
115 | KOMonthView *mMonthView; | 116 | KOMonthView *mMonthView; |
116 | KOTodoView *mTodoView; | 117 | KOTodoView *mTodoView; |
117 | KOWhatsNextView *mWhatsNextView; | 118 | KOWhatsNextView *mWhatsNextView; |
118 | KOJournalView *mJournalView; | 119 | KOJournalView *mJournalView; |
119 | KOTimeSpanView *mTimeSpanView; | 120 | KOTimeSpanView *mTimeSpanView; |
120 | 121 | ||
121 | KOrg::BaseView *mCurrentView; // currently active event view | 122 | KOrg::BaseView *mCurrentView; // currently active event view |
122 | 123 | ||
123 | int mAgendaViewMode; | 124 | int mAgendaViewMode; |
124 | bool mFlagShowNextxDays; | 125 | bool mFlagShowNextxDays; |
125 | 126 | ||
126 | }; | 127 | }; |
127 | 128 | ||
128 | #endif | 129 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index d8373a6..fb6d6ec 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,433 +1,434 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "kojournalview.h" | ||
50 | #include "koagenda.h" | 51 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 52 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 53 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 54 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 55 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 56 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 57 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 58 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 59 | #include "koglobals.h" |
59 | #include "kglobal.h" | 60 | #include "kglobal.h" |
60 | #include "ktoolbar.h" | 61 | #include "ktoolbar.h" |
61 | #include "klocale.h" | 62 | #include "klocale.h" |
62 | #include "kconfig.h" | 63 | #include "kconfig.h" |
63 | #include "externalapphandler.h" | 64 | #include "externalapphandler.h" |
64 | #include <kglobalsettings.h> | 65 | #include <kglobalsettings.h> |
65 | 66 | ||
66 | using namespace KCal; | 67 | using namespace KCal; |
67 | #ifndef _WIN32_ | 68 | #ifndef _WIN32_ |
68 | #include <unistd.h> | 69 | #include <unistd.h> |
69 | #else | 70 | #else |
70 | #ifdef _OL_IMPORT_ | 71 | #ifdef _OL_IMPORT_ |
71 | #include "koimportoldialog.h" | 72 | #include "koimportoldialog.h" |
72 | #endif | 73 | #endif |
73 | #endif | 74 | #endif |
74 | #include "mainwindow.h" | 75 | #include "mainwindow.h" |
75 | 76 | ||
76 | 77 | ||
77 | class KOex2phonePrefs : public QDialog | 78 | class KOex2phonePrefs : public QDialog |
78 | { | 79 | { |
79 | public: | 80 | public: |
80 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 81 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
81 | QDialog( parent, name, true ) | 82 | QDialog( parent, name, true ) |
82 | { | 83 | { |
83 | setCaption( i18n("Export to phone options") ); | 84 | setCaption( i18n("Export to phone options") ); |
84 | QVBoxLayout* lay = new QVBoxLayout( this ); | 85 | QVBoxLayout* lay = new QVBoxLayout( this ); |
85 | lay->setSpacing( 3 ); | 86 | lay->setSpacing( 3 ); |
86 | lay->setMargin( 3 ); | 87 | lay->setMargin( 3 ); |
87 | QLabel *lab; | 88 | QLabel *lab; |
88 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 89 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
89 | lab->setAlignment (AlignHCenter ); | 90 | lab->setAlignment (AlignHCenter ); |
90 | QHBox* temphb; | 91 | QHBox* temphb; |
91 | temphb = new QHBox( this ); | 92 | temphb = new QHBox( this ); |
92 | new QLabel( i18n("I/O device: "), temphb ); | 93 | new QLabel( i18n("I/O device: "), temphb ); |
93 | mPhoneDevice = new QLineEdit( temphb); | 94 | mPhoneDevice = new QLineEdit( temphb); |
94 | lay->addWidget( temphb ); | 95 | lay->addWidget( temphb ); |
95 | temphb = new QHBox( this ); | 96 | temphb = new QHBox( this ); |
96 | new QLabel( i18n("Connection: "), temphb ); | 97 | new QLabel( i18n("Connection: "), temphb ); |
97 | mPhoneConnection = new QLineEdit( temphb); | 98 | mPhoneConnection = new QLineEdit( temphb); |
98 | lay->addWidget( temphb ); | 99 | lay->addWidget( temphb ); |
99 | temphb = new QHBox( this ); | 100 | temphb = new QHBox( this ); |
100 | new QLabel( i18n("Model(opt.): "), temphb ); | 101 | new QLabel( i18n("Model(opt.): "), temphb ); |
101 | mPhoneModel = new QLineEdit( temphb); | 102 | mPhoneModel = new QLineEdit( temphb); |
102 | lay->addWidget( temphb ); | 103 | lay->addWidget( temphb ); |
103 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 104 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
104 | mWriteBackFuture->setChecked( true ); | 105 | mWriteBackFuture->setChecked( true ); |
105 | lay->addWidget( mWriteBackFuture ); | 106 | lay->addWidget( mWriteBackFuture ); |
106 | temphb = new QHBox( this ); | 107 | temphb = new QHBox( this ); |
107 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 108 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
108 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 109 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
109 | mWriteBackFutureWeeks->setValue( 8 ); | 110 | mWriteBackFutureWeeks->setValue( 8 ); |
110 | lay->addWidget( temphb ); | 111 | lay->addWidget( temphb ); |
111 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 112 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
112 | lab->setAlignment (AlignHCenter ); | 113 | lab->setAlignment (AlignHCenter ); |
113 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 114 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
114 | lay->addWidget( ok ); | 115 | lay->addWidget( ok ); |
115 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 116 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
116 | lay->addWidget( cancel ); | 117 | lay->addWidget( cancel ); |
117 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 118 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
118 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 119 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
119 | resize( 220, 240 ); | 120 | resize( 220, 240 ); |
120 | qApp->processEvents(); | 121 | qApp->processEvents(); |
121 | int dw = QApplication::desktop()->width(); | 122 | int dw = QApplication::desktop()->width(); |
122 | int dh = QApplication::desktop()->height(); | 123 | int dh = QApplication::desktop()->height(); |
123 | move( (dw-width())/2, (dh - height() )/2 ); | 124 | move( (dw-width())/2, (dh - height() )/2 ); |
124 | } | 125 | } |
125 | 126 | ||
126 | public: | 127 | public: |
127 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 128 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
128 | QCheckBox* mWriteBackFuture; | 129 | QCheckBox* mWriteBackFuture; |
129 | QSpinBox* mWriteBackFutureWeeks; | 130 | QSpinBox* mWriteBackFutureWeeks; |
130 | }; | 131 | }; |
131 | 132 | ||
132 | QPixmap* sgListViewCompletedPix[6]; | 133 | QPixmap* sgListViewCompletedPix[6]; |
133 | 134 | ||
134 | 135 | ||
135 | int globalFlagBlockStartup; | 136 | int globalFlagBlockStartup; |
136 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 137 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
137 | QMainWindow( parent, name ) | 138 | QMainWindow( parent, name ) |
138 | { | 139 | { |
139 | sgListViewCompletedPix[5] = &listviewPix; | 140 | sgListViewCompletedPix[5] = &listviewPix; |
140 | sgListViewCompletedPix[0] = &listviewPix0; | 141 | sgListViewCompletedPix[0] = &listviewPix0; |
141 | sgListViewCompletedPix[1] = &listviewPix20; | 142 | sgListViewCompletedPix[1] = &listviewPix20; |
142 | sgListViewCompletedPix[2] = &listviewPix40; | 143 | sgListViewCompletedPix[2] = &listviewPix40; |
143 | sgListViewCompletedPix[3] = &listviewPix60; | 144 | sgListViewCompletedPix[3] = &listviewPix60; |
144 | sgListViewCompletedPix[4] = &listviewPix80; | 145 | sgListViewCompletedPix[4] = &listviewPix80; |
145 | if ( sgListViewCompletedPix[5]->height() < 5 ) { | 146 | if ( sgListViewCompletedPix[5]->height() < 5 ) { |
146 | int size = 12; | 147 | int size = 12; |
147 | sgListViewCompletedPix[5]->resize( 11, 11 ); | 148 | sgListViewCompletedPix[5]->resize( 11, 11 ); |
148 | sgListViewCompletedPix[5]->fill( Qt::white ); | 149 | sgListViewCompletedPix[5]->fill( Qt::white ); |
149 | QPainter p ( sgListViewCompletedPix[5] ); | 150 | QPainter p ( sgListViewCompletedPix[5] ); |
150 | p.drawRect( 0,0,11,11); | 151 | p.drawRect( 0,0,11,11); |
151 | int half = size/2; | 152 | int half = size/2; |
152 | int heihei = size/2; | 153 | int heihei = size/2; |
153 | int x = 1; | 154 | int x = 1; |
154 | p.drawLine ( 2, 5, 4 , 7 ) ; | 155 | p.drawLine ( 2, 5, 4 , 7 ) ; |
155 | p.drawLine ( 4 , 7 , 8, 3) ; | 156 | p.drawLine ( 4 , 7 , 8, 3) ; |
156 | int iii = 0; | 157 | int iii = 0; |
157 | for ( iii = 0; iii < 5; ++iii ) { | 158 | for ( iii = 0; iii < 5; ++iii ) { |
158 | sgListViewCompletedPix[iii]->resize( 11, 11 ); | 159 | sgListViewCompletedPix[iii]->resize( 11, 11 ); |
159 | sgListViewCompletedPix[iii]->fill( Qt::white ); | 160 | sgListViewCompletedPix[iii]->fill( Qt::white ); |
160 | QPainter p ( sgListViewCompletedPix[iii] ); | 161 | QPainter p ( sgListViewCompletedPix[iii] ); |
161 | p.drawRect( 0,0,11,11); | 162 | p.drawRect( 0,0,11,11); |
162 | if ( iii ) | 163 | if ( iii ) |
163 | p.fillRect( 1,1,iii*2,9,Qt::gray ); | 164 | p.fillRect( 1,1,iii*2,9,Qt::gray ); |
164 | } | 165 | } |
165 | } | 166 | } |
166 | mClosed = false; | 167 | mClosed = false; |
167 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 168 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
168 | QString confFile = locateLocal("config","korganizerrc"); | 169 | QString confFile = locateLocal("config","korganizerrc"); |
169 | QFileInfo finf ( confFile ); | 170 | QFileInfo finf ( confFile ); |
170 | bool showWarning = !finf.exists(); | 171 | bool showWarning = !finf.exists(); |
171 | setIcon(SmallIcon( "ko24" ) ); | 172 | setIcon(SmallIcon( "ko24" ) ); |
172 | mBlockAtStartup = true; | 173 | mBlockAtStartup = true; |
173 | mFlagKeyPressed = false; | 174 | mFlagKeyPressed = false; |
174 | setCaption("KO/Pi"); | 175 | setCaption("KO/Pi"); |
175 | KOPrefs *p = KOPrefs::instance(); | 176 | KOPrefs *p = KOPrefs::instance(); |
176 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 177 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
177 | p->mCurrentDisplayedView = 0; | 178 | p->mCurrentDisplayedView = 0; |
178 | if ( p->mHourSize > 22 ) | 179 | if ( p->mHourSize > 22 ) |
179 | p->mHourSize = 22; | 180 | p->mHourSize = 22; |
180 | QMainWindow::ToolBarDock tbd; | 181 | QMainWindow::ToolBarDock tbd; |
181 | if ( p->mToolBarHor ) { | 182 | if ( p->mToolBarHor ) { |
182 | if ( p->mToolBarUp ) | 183 | if ( p->mToolBarUp ) |
183 | tbd = Bottom; | 184 | tbd = Bottom; |
184 | else | 185 | else |
185 | tbd = Top; | 186 | tbd = Top; |
186 | } | 187 | } |
187 | else { | 188 | else { |
188 | if ( p->mToolBarUp ) | 189 | if ( p->mToolBarUp ) |
189 | tbd = Right; | 190 | tbd = Right; |
190 | else | 191 | else |
191 | tbd = Left; | 192 | tbd = Left; |
192 | } | 193 | } |
193 | if ( KOPrefs::instance()->mUseAppColors ) | 194 | if ( KOPrefs::instance()->mUseAppColors ) |
194 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 195 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
195 | globalFlagBlockStartup = 1; | 196 | globalFlagBlockStartup = 1; |
196 | iconToolBar = new QPEToolBar( this ); | 197 | iconToolBar = new QPEToolBar( this ); |
197 | addToolBar (iconToolBar , tbd ); | 198 | addToolBar (iconToolBar , tbd ); |
198 | 199 | ||
199 | #ifdef DESKTOP_VERSION | 200 | #ifdef DESKTOP_VERSION |
200 | if ( KOPrefs::instance()->mShowIconFilter ) | 201 | if ( KOPrefs::instance()->mShowIconFilter ) |
201 | #else | 202 | #else |
202 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) | 203 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) |
203 | #endif | 204 | #endif |
204 | 205 | ||
205 | { | 206 | { |
206 | if ( p->mToolBarHorF ) { | 207 | if ( p->mToolBarHorF ) { |
207 | if ( p->mToolBarUpF ) | 208 | if ( p->mToolBarUpF ) |
208 | tbd = Bottom; | 209 | tbd = Bottom; |
209 | else | 210 | else |
210 | tbd = Top; | 211 | tbd = Top; |
211 | } | 212 | } |
212 | else { | 213 | else { |
213 | if ( p->mToolBarUpF ) | 214 | if ( p->mToolBarUpF ) |
214 | tbd = Right; | 215 | tbd = Right; |
215 | else | 216 | else |
216 | tbd = Left; | 217 | tbd = Left; |
217 | } | 218 | } |
218 | filterToolBar = new QPEToolBar ( this ); | 219 | filterToolBar = new QPEToolBar ( this ); |
219 | filterMenubar = new QMenuBar( 0 ); | 220 | filterMenubar = new QMenuBar( 0 ); |
220 | QFontMetrics fm ( filterMenubar->font() ); | 221 | QFontMetrics fm ( filterMenubar->font() ); |
221 | 222 | ||
222 | filterPopupMenu = new QPopupMenu( this ); | 223 | filterPopupMenu = new QPopupMenu( this ); |
223 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); | 224 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); |
224 | QString addTest = "A"; | 225 | QString addTest = "A"; |
225 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); | 226 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); |
226 | #ifdef DESKTOP_VERSION | 227 | #ifdef DESKTOP_VERSION |
227 | addTest = "AAABBBCCCx"; | 228 | addTest = "AAABBBCCCx"; |
228 | #else | 229 | #else |
229 | addTest = "AAx"; | 230 | addTest = "AAx"; |
230 | #endif | 231 | #endif |
231 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); | 232 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); |
232 | addToolBar (filterToolBar , tbd ); | 233 | addToolBar (filterToolBar , tbd ); |
233 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); | 234 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); |
234 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); | 235 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); |
235 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) | 236 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) |
236 | filterToolBar->hide(); | 237 | filterToolBar->hide(); |
237 | } else { | 238 | } else { |
238 | filterToolBar = 0; | 239 | filterToolBar = 0; |
239 | filterMenubar = 0; | 240 | filterMenubar = 0; |
240 | filterPopupMenu = 0; | 241 | filterPopupMenu = 0; |
241 | } | 242 | } |
242 | if ( p->mShowIconOnetoolbar ) { | 243 | if ( p->mShowIconOnetoolbar ) { |
243 | viewToolBar = iconToolBar ; | 244 | viewToolBar = iconToolBar ; |
244 | navigatorToolBar = iconToolBar ; | 245 | navigatorToolBar = iconToolBar ; |
245 | } else { | 246 | } else { |
246 | #ifndef DESKTOP_VERSION | 247 | #ifndef DESKTOP_VERSION |
247 | setToolBarsMovable( false ); | 248 | setToolBarsMovable( false ); |
248 | #endif | 249 | #endif |
249 | if ( p->mToolBarHorV ) { | 250 | if ( p->mToolBarHorV ) { |
250 | if ( p->mToolBarUpV ) | 251 | if ( p->mToolBarUpV ) |
251 | tbd = Bottom; | 252 | tbd = Bottom; |
252 | else | 253 | else |
253 | tbd = Top; | 254 | tbd = Top; |
254 | } | 255 | } |
255 | else { | 256 | else { |
256 | if ( p->mToolBarUpV ) | 257 | if ( p->mToolBarUpV ) |
257 | tbd = Right; | 258 | tbd = Right; |
258 | else | 259 | else |
259 | tbd = Left; | 260 | tbd = Left; |
260 | } | 261 | } |
261 | viewToolBar = new QPEToolBar( this ); | 262 | viewToolBar = new QPEToolBar( this ); |
262 | addToolBar (viewToolBar , tbd ); | 263 | addToolBar (viewToolBar , tbd ); |
263 | if ( p->mToolBarHorN ) { | 264 | if ( p->mToolBarHorN ) { |
264 | if ( p->mToolBarUpN ) | 265 | if ( p->mToolBarUpN ) |
265 | tbd = Bottom; | 266 | tbd = Bottom; |
266 | else | 267 | else |
267 | tbd = Top; | 268 | tbd = Top; |
268 | } | 269 | } |
269 | else { | 270 | else { |
270 | if ( p->mToolBarUpN ) | 271 | if ( p->mToolBarUpN ) |
271 | tbd = Right; | 272 | tbd = Right; |
272 | else | 273 | else |
273 | tbd = Left; | 274 | tbd = Left; |
274 | } | 275 | } |
275 | navigatorToolBar = new QPEToolBar( this ); | 276 | navigatorToolBar = new QPEToolBar( this ); |
276 | addToolBar (navigatorToolBar , tbd ); | 277 | addToolBar (navigatorToolBar , tbd ); |
277 | } | 278 | } |
278 | 279 | ||
279 | 280 | ||
280 | 281 | ||
281 | mCalendarModifiedFlag = false; | 282 | mCalendarModifiedFlag = false; |
282 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 283 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
283 | splash->setAlignment ( AlignCenter ); | 284 | splash->setAlignment ( AlignCenter ); |
284 | setCentralWidget( splash ); | 285 | setCentralWidget( splash ); |
285 | #ifndef DESKTOP_VERSION | 286 | #ifndef DESKTOP_VERSION |
286 | showMaximized(); | 287 | showMaximized(); |
287 | #endif | 288 | #endif |
288 | 289 | ||
289 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 290 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
290 | setDefaultPreferences(); | 291 | setDefaultPreferences(); |
291 | mCalendar = new CalendarLocal(); | 292 | mCalendar = new CalendarLocal(); |
292 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 293 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
293 | mView->hide(); | 294 | mView->hide(); |
294 | //mView->resize(splash->size() ); | 295 | //mView->resize(splash->size() ); |
295 | initActions(); | 296 | initActions(); |
296 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 297 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
297 | mSyncManager->setBlockSave(false); | 298 | mSyncManager->setBlockSave(false); |
298 | mView->setSyncManager(mSyncManager); | 299 | mView->setSyncManager(mSyncManager); |
299 | #ifndef DESKTOP_VERSION | 300 | #ifndef DESKTOP_VERSION |
300 | iconToolBar->show(); | 301 | iconToolBar->show(); |
301 | qApp->processEvents(); | 302 | qApp->processEvents(); |
302 | #endif | 303 | #endif |
303 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 304 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
304 | int vh = height() ; | 305 | int vh = height() ; |
305 | int vw = width(); | 306 | int vw = width(); |
306 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 307 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
307 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 308 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
308 | vh -= iconToolBar->height(); | 309 | vh -= iconToolBar->height(); |
309 | } else { | 310 | } else { |
310 | vw -= iconToolBar->height(); | 311 | vw -= iconToolBar->height(); |
311 | } | 312 | } |
312 | //mView->setMaximumSize( splash->size() ); | 313 | //mView->setMaximumSize( splash->size() ); |
313 | //mView->resize( splash->size() ); | 314 | //mView->resize( splash->size() ); |
314 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 315 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
315 | mView->readSettings(); | 316 | mView->readSettings(); |
316 | bool newFile = false; | 317 | bool newFile = false; |
317 | if( !QFile::exists( defaultFileName() ) ) { | 318 | if( !QFile::exists( defaultFileName() ) ) { |
318 | QFileInfo finfo ( defaultFileName() ); | 319 | QFileInfo finfo ( defaultFileName() ); |
319 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 320 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
320 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 321 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
321 | finfo.setFile( oldFile ); | 322 | finfo.setFile( oldFile ); |
322 | if (finfo.exists() ) { | 323 | if (finfo.exists() ) { |
323 | KMessageBox::information( this, message); | 324 | KMessageBox::information( this, message); |
324 | mView->openCalendar( oldFile ); | 325 | mView->openCalendar( oldFile ); |
325 | qApp->processEvents(); | 326 | qApp->processEvents(); |
326 | } else { | 327 | } else { |
327 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 328 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
328 | finfo.setFile( oldFile ); | 329 | finfo.setFile( oldFile ); |
329 | if (finfo.exists() ) { | 330 | if (finfo.exists() ) { |
330 | KMessageBox::information( this, message); | 331 | KMessageBox::information( this, message); |
331 | mView->openCalendar( oldFile ); | 332 | mView->openCalendar( oldFile ); |
332 | qApp->processEvents(); | 333 | qApp->processEvents(); |
333 | } | 334 | } |
334 | } | 335 | } |
335 | mView->saveCalendar( defaultFileName() ); | 336 | mView->saveCalendar( defaultFileName() ); |
336 | newFile = true; | 337 | newFile = true; |
337 | } | 338 | } |
338 | 339 | ||
339 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 340 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
340 | mView->loadCalendars(); | 341 | mView->loadCalendars(); |
341 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 342 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
342 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 343 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
343 | 344 | ||
344 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 345 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
345 | KOPrefs::instance()->setAllDefaults(); | 346 | KOPrefs::instance()->setAllDefaults(); |
346 | int count = mView->addCategories(); | 347 | int count = mView->addCategories(); |
347 | } | 348 | } |
348 | processIncidenceSelection( 0 ); | 349 | processIncidenceSelection( 0 ); |
349 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 350 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
350 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 351 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
351 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 352 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
352 | SLOT( slotModifiedChanged( bool ) ) ); | 353 | SLOT( slotModifiedChanged( bool ) ) ); |
353 | 354 | ||
354 | 355 | ||
355 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 356 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
356 | SLOT( disableBR(bool) ) ); | 357 | SLOT( disableBR(bool) ) ); |
357 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 358 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
358 | mView->setModified( false ); | 359 | mView->setModified( false ); |
359 | mBlockAtStartup = false; | 360 | mBlockAtStartup = false; |
360 | mView->setModified( false ); | 361 | mView->setModified( false ); |
361 | setCentralWidget( mView ); | 362 | setCentralWidget( mView ); |
362 | globalFlagBlockStartup = 0; | 363 | globalFlagBlockStartup = 0; |
363 | mView->show(); | 364 | mView->show(); |
364 | delete splash; | 365 | delete splash; |
365 | if ( newFile ) | 366 | if ( newFile ) |
366 | mView->updateConfig(); | 367 | mView->updateConfig(); |
367 | // qApp->processEvents(); | 368 | // qApp->processEvents(); |
368 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 369 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
369 | //fillSyncMenu(); | 370 | //fillSyncMenu(); |
370 | 371 | ||
371 | 372 | ||
372 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 373 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
373 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 374 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
374 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 375 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
375 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 376 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
376 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 377 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
377 | mSyncManager->setDefaultFileName( sentSyncFile()); | 378 | mSyncManager->setDefaultFileName( sentSyncFile()); |
378 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 379 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
379 | mSyncManager->fillSyncMenu(); | 380 | mSyncManager->fillSyncMenu(); |
380 | 381 | ||
381 | 382 | ||
382 | 383 | ||
383 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 384 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
384 | if ( showWarning ) { | 385 | if ( showWarning ) { |
385 | KMessageBox::information( this, | 386 | KMessageBox::information( this, |
386 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 387 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
387 | qApp->processEvents(); | 388 | qApp->processEvents(); |
388 | mView->dialogManager()->showSyncOptions(); | 389 | mView->dialogManager()->showSyncOptions(); |
389 | } | 390 | } |
390 | 391 | ||
391 | //US listen for result adressed from Ka/Pi | 392 | //US listen for result adressed from Ka/Pi |
392 | #ifndef DESKTOP_VERSION | 393 | #ifndef DESKTOP_VERSION |
393 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 394 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
394 | #endif | 395 | #endif |
395 | #ifndef DESKTOP_VERSION | 396 | #ifndef DESKTOP_VERSION |
396 | infrared = 0; | 397 | infrared = 0; |
397 | #endif | 398 | #endif |
398 | updateFilterToolbar(); | 399 | updateFilterToolbar(); |
399 | updateWeek( mView->startDate() ); | 400 | updateWeek( mView->startDate() ); |
400 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 401 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
401 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 402 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
402 | mBRdisabled = false; | 403 | mBRdisabled = false; |
403 | //toggleBeamReceive(); | 404 | //toggleBeamReceive(); |
404 | int tiint= 3000; | 405 | int tiint= 3000; |
405 | #ifndef DESKTOP_VERSION | 406 | #ifndef DESKTOP_VERSION |
406 | tiint = 5000; | 407 | tiint = 5000; |
407 | #endif | 408 | #endif |
408 | QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() )); | 409 | QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() )); |
409 | } | 410 | } |
410 | MainWindow::~MainWindow() | 411 | MainWindow::~MainWindow() |
411 | { | 412 | { |
412 | //qDebug("MainWindow::~MainWindow() "); | 413 | //qDebug("MainWindow::~MainWindow() "); |
413 | //save toolbar location | 414 | //save toolbar location |
414 | delete mCalendar; | 415 | delete mCalendar; |
415 | delete mSyncManager; | 416 | delete mSyncManager; |
416 | #ifndef DESKTOP_VERSION | 417 | #ifndef DESKTOP_VERSION |
417 | if ( infrared ) | 418 | if ( infrared ) |
418 | delete infrared; | 419 | delete infrared; |
419 | #endif | 420 | #endif |
420 | 421 | ||
421 | 422 | ||
422 | } | 423 | } |
423 | 424 | ||
424 | void MainWindow::disableBR(bool b) | 425 | void MainWindow::disableBR(bool b) |
425 | { | 426 | { |
426 | #ifndef DESKTOP_VERSION | 427 | #ifndef DESKTOP_VERSION |
427 | if ( b ) { | 428 | if ( b ) { |
428 | if ( infrared ) { | 429 | if ( infrared ) { |
429 | toggleBeamReceive(); | 430 | toggleBeamReceive(); |
430 | mBRdisabled = true; | 431 | mBRdisabled = true; |
431 | } | 432 | } |
432 | mBRdisabled = true; | 433 | mBRdisabled = true; |
433 | } else { | 434 | } else { |
@@ -1453,833 +1454,836 @@ void MainWindow::displayText( QString text ,QString cap ) | |||
1453 | lay->setMargin( 3 ); | 1454 | lay->setMargin( 3 ); |
1454 | QTextBrowser tb ( &dia ); | 1455 | QTextBrowser tb ( &dia ); |
1455 | lay->addWidget( &tb ); | 1456 | lay->addWidget( &tb ); |
1456 | tb.setText( text ); | 1457 | tb.setText( text ); |
1457 | #ifdef DESKTOP_VERSION | 1458 | #ifdef DESKTOP_VERSION |
1458 | dia.resize( 640, 480); | 1459 | dia.resize( 640, 480); |
1459 | #else | 1460 | #else |
1460 | dia.showMaximized(); | 1461 | dia.showMaximized(); |
1461 | #endif | 1462 | #endif |
1462 | dia.exec(); | 1463 | dia.exec(); |
1463 | } | 1464 | } |
1464 | 1465 | ||
1465 | void MainWindow::features() | 1466 | void MainWindow::features() |
1466 | { | 1467 | { |
1467 | 1468 | ||
1468 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1469 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1469 | } | 1470 | } |
1470 | 1471 | ||
1471 | void MainWindow::usertrans() | 1472 | void MainWindow::usertrans() |
1472 | { | 1473 | { |
1473 | 1474 | ||
1474 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1475 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1475 | } | 1476 | } |
1476 | 1477 | ||
1477 | void MainWindow::storagehowto() | 1478 | void MainWindow::storagehowto() |
1478 | { | 1479 | { |
1479 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 1480 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
1480 | } | 1481 | } |
1481 | void MainWindow::timetrackinghowto() | 1482 | void MainWindow::timetrackinghowto() |
1482 | { | 1483 | { |
1483 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); | 1484 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); |
1484 | } | 1485 | } |
1485 | void MainWindow::kdesynchowto() | 1486 | void MainWindow::kdesynchowto() |
1486 | { | 1487 | { |
1487 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1488 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1488 | } | 1489 | } |
1489 | void MainWindow::multisynchowto() | 1490 | void MainWindow::multisynchowto() |
1490 | { | 1491 | { |
1491 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1492 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1492 | } | 1493 | } |
1493 | void MainWindow::synchowto() | 1494 | void MainWindow::synchowto() |
1494 | { | 1495 | { |
1495 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1496 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1496 | } | 1497 | } |
1497 | void MainWindow::faq() | 1498 | void MainWindow::faq() |
1498 | { | 1499 | { |
1499 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1500 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1500 | 1501 | ||
1501 | } | 1502 | } |
1502 | void MainWindow::whatsNew() | 1503 | void MainWindow::whatsNew() |
1503 | { | 1504 | { |
1504 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1505 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1505 | 1506 | ||
1506 | } | 1507 | } |
1507 | void MainWindow::licence() | 1508 | void MainWindow::licence() |
1508 | { | 1509 | { |
1509 | KApplication::showLicence(); | 1510 | KApplication::showLicence(); |
1510 | 1511 | ||
1511 | } | 1512 | } |
1512 | void MainWindow::about() | 1513 | void MainWindow::about() |
1513 | { | 1514 | { |
1514 | QString version; | 1515 | QString version; |
1515 | #include <../version> | 1516 | #include <../version> |
1516 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1517 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1517 | i18n("KOrganizer/Platform-independent\n") + | 1518 | i18n("KOrganizer/Platform-independent\n") + |
1518 | "(KO/Pi) " + version + " - " + | 1519 | "(KO/Pi) " + version + " - " + |
1519 | 1520 | ||
1520 | #ifdef DESKTOP_VERSION | 1521 | #ifdef DESKTOP_VERSION |
1521 | i18n("Desktop Edition\n") + | 1522 | i18n("Desktop Edition\n") + |
1522 | #else | 1523 | #else |
1523 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1524 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1524 | #endif | 1525 | #endif |
1525 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1526 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1526 | } | 1527 | } |
1527 | void MainWindow::keyBindings() | 1528 | void MainWindow::keyBindings() |
1528 | { | 1529 | { |
1529 | QString cap = i18n("KO/Pi Keys + Colors"); | 1530 | QString cap = i18n("KO/Pi Keys + Colors"); |
1530 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1531 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1531 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1532 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1532 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + | 1533 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + |
1533 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + | 1534 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + |
1534 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1535 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1535 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1536 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1536 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ | 1537 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ |
1537 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1538 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1538 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1539 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1539 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ | 1540 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ |
1540 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1541 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1541 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1542 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1542 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1543 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1543 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1544 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1544 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1545 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1545 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1546 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1546 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ | 1547 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ |
1547 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1548 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1548 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1549 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1549 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1550 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1550 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1551 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1551 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1552 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1552 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1553 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1553 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1554 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1554 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1555 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1555 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1556 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1556 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1557 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1557 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1558 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1558 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1559 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1559 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1560 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1560 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1561 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1561 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1562 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1562 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1563 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1563 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1564 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1564 | i18n("<p><h3>In list view:</h3></p>\n") + | 1565 | i18n("<p><h3>In list view:</h3></p>\n") + |
1565 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1566 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1566 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1567 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1567 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1568 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1568 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1569 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1569 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1570 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1570 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1571 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1571 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1572 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1572 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1573 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1573 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1574 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1574 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1575 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1575 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1576 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1576 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1577 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1577 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1578 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1578 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1579 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1579 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1580 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1580 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1581 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1581 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1582 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1582 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1583 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1583 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1584 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1584 | displayText( text, cap); | 1585 | displayText( text, cap); |
1585 | } | 1586 | } |
1586 | void MainWindow::aboutAutoSaving() | 1587 | void MainWindow::aboutAutoSaving() |
1587 | { | 1588 | { |
1588 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1589 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1589 | 1590 | ||
1590 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1591 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1591 | 1592 | ||
1592 | } | 1593 | } |
1593 | void MainWindow::aboutKnownBugs() | 1594 | void MainWindow::aboutKnownBugs() |
1594 | { | 1595 | { |
1595 | QMessageBox* msg; | 1596 | QMessageBox* msg; |
1596 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1597 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1597 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1598 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1598 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1599 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1599 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1600 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1600 | i18n("\nor report them in the bugtracker on\n") + | 1601 | i18n("\nor report them in the bugtracker on\n") + |
1601 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1602 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1602 | QMessageBox::NoIcon, | 1603 | QMessageBox::NoIcon, |
1603 | QMessageBox::Ok, | 1604 | QMessageBox::Ok, |
1604 | QMessageBox::NoButton, | 1605 | QMessageBox::NoButton, |
1605 | QMessageBox::NoButton); | 1606 | QMessageBox::NoButton); |
1606 | msg->exec(); | 1607 | msg->exec(); |
1607 | delete msg; | 1608 | delete msg; |
1608 | 1609 | ||
1609 | } | 1610 | } |
1610 | 1611 | ||
1611 | QString MainWindow::defaultFileName() | 1612 | QString MainWindow::defaultFileName() |
1612 | { | 1613 | { |
1613 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1614 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1614 | } | 1615 | } |
1615 | QString MainWindow::syncFileName() | 1616 | QString MainWindow::syncFileName() |
1616 | { | 1617 | { |
1617 | #ifdef DESKTOP_VERSION | 1618 | #ifdef DESKTOP_VERSION |
1618 | return locateLocal( "tmp", "synccalendar.ics" ); | 1619 | return locateLocal( "tmp", "synccalendar.ics" ); |
1619 | #else | 1620 | #else |
1620 | return QString( "/tmp/synccalendar.ics" ); | 1621 | return QString( "/tmp/synccalendar.ics" ); |
1621 | #endif | 1622 | #endif |
1622 | } | 1623 | } |
1623 | #include "koglobals.h" | 1624 | #include "koglobals.h" |
1624 | #include <kcalendarsystem.h> | 1625 | #include <kcalendarsystem.h> |
1625 | void MainWindow::updateWeek(QDate seda) | 1626 | void MainWindow::updateWeek(QDate seda) |
1626 | { | 1627 | { |
1627 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1628 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1628 | mWeekPixmap.fill( mWeekBgColor ); | 1629 | mWeekPixmap.fill( mWeekBgColor ); |
1629 | QPainter p ( &mWeekPixmap ); | 1630 | QPainter p ( &mWeekPixmap ); |
1630 | p.setFont( mWeekFont ); | 1631 | p.setFont( mWeekFont ); |
1631 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1632 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1632 | p.end(); | 1633 | p.end(); |
1633 | QIconSet icon3 ( mWeekPixmap ); | 1634 | QIconSet icon3 ( mWeekPixmap ); |
1634 | mWeekAction->setIconSet ( icon3 ); | 1635 | mWeekAction->setIconSet ( icon3 ); |
1635 | 1636 | ||
1636 | } | 1637 | } |
1637 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1638 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1638 | { | 1639 | { |
1639 | updateWeek( selectedDates.first() ); | 1640 | updateWeek( selectedDates.first() ); |
1640 | } | 1641 | } |
1641 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1642 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1642 | { | 1643 | { |
1643 | 1644 | ||
1644 | if ( !incidence ) { | 1645 | if ( !incidence ) { |
1645 | enableIncidenceActions( false ); | 1646 | enableIncidenceActions( false ); |
1646 | 1647 | ||
1647 | mNewSubTodoAction->setEnabled( false ); | 1648 | mNewSubTodoAction->setEnabled( false ); |
1648 | setCaptionToDates(); | 1649 | setCaptionToDates(); |
1649 | return; | 1650 | return; |
1650 | 1651 | ||
1651 | } | 1652 | } |
1652 | 1653 | ||
1653 | //KGlobal::locale()->formatDateTime(nextA, true); | 1654 | //KGlobal::locale()->formatDateTime(nextA, true); |
1654 | QString startString = ""; | 1655 | QString startString = ""; |
1655 | if ( incidence->typeID() != todoID ) { | 1656 | if ( incidence->typeID() != todoID ) { |
1656 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1657 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1657 | if ( incidence->doesFloat() ) { | 1658 | if ( incidence->doesFloat() ) { |
1658 | startString += ": "+incidence->dtStartDateStr( true ); | 1659 | startString += ": "+incidence->dtStartDateStr( true ); |
1659 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1660 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1660 | 1661 | ||
1661 | } else { | 1662 | } else { |
1662 | startString = ": "+incidence->dtStartStr(true); | 1663 | startString = ": "+incidence->dtStartStr(true); |
1663 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1664 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1664 | 1665 | ||
1665 | } | 1666 | } |
1666 | 1667 | ||
1667 | } else { | 1668 | } else { |
1668 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1669 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1669 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1670 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1670 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1671 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1671 | 1672 | ||
1672 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { | 1673 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { |
1673 | bool ok; | 1674 | bool ok; |
1674 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1675 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1675 | if ( ok ) { | 1676 | if ( ok ) { |
1676 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1677 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1677 | startString += i18n(" (%1 y.)"). arg( years ); | 1678 | startString += i18n(" (%1 y.)"). arg( years ); |
1678 | } | 1679 | } |
1679 | } | 1680 | } |
1680 | else | 1681 | else |
1681 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1682 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1682 | } | 1683 | } |
1683 | 1684 | ||
1684 | } | 1685 | } |
1685 | else | 1686 | else |
1686 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1687 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1687 | if ( !incidence->location().isEmpty() ) | 1688 | if ( !incidence->location().isEmpty() ) |
1688 | startString += " (" +incidence->location()+")"; | 1689 | startString += " (" +incidence->location()+")"; |
1689 | setCaption( incidence->summary()+startString); | 1690 | setCaption( incidence->summary()+startString); |
1690 | 1691 | ||
1691 | enableIncidenceActions( true ); | 1692 | enableIncidenceActions( true ); |
1692 | 1693 | ||
1693 | if ( incidence->typeID() == eventID ) { | 1694 | if ( incidence->typeID() == eventID ) { |
1694 | mShowAction->setText( i18n("Show Event...") ); | 1695 | mShowAction->setText( i18n("Show Event...") ); |
1695 | mEditAction->setText( i18n("Edit Event...") ); | 1696 | mEditAction->setText( i18n("Edit Event...") ); |
1696 | mDeleteAction->setText( i18n("Delete Event...") ); | 1697 | mDeleteAction->setText( i18n("Delete Event...") ); |
1697 | 1698 | ||
1698 | mNewSubTodoAction->setEnabled( false ); | 1699 | mNewSubTodoAction->setEnabled( false ); |
1699 | } else if ( incidence->typeID() == todoID ) { | 1700 | } else if ( incidence->typeID() == todoID ) { |
1700 | mShowAction->setText( i18n("Show Todo...") ); | 1701 | mShowAction->setText( i18n("Show Todo...") ); |
1701 | mEditAction->setText( i18n("Edit Todo...") ); | 1702 | mEditAction->setText( i18n("Edit Todo...") ); |
1702 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1703 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1703 | 1704 | ||
1704 | mNewSubTodoAction->setEnabled( true ); | 1705 | mNewSubTodoAction->setEnabled( true ); |
1705 | } else { | 1706 | } else { |
1706 | mShowAction->setText( i18n("Show...") ); | 1707 | mShowAction->setText( i18n("Show...") ); |
1707 | mShowAction->setText( i18n("Edit...") ); | 1708 | mShowAction->setText( i18n("Edit...") ); |
1708 | mShowAction->setText( i18n("Delete...") ); | 1709 | mShowAction->setText( i18n("Delete...") ); |
1709 | 1710 | ||
1710 | mNewSubTodoAction->setEnabled( false ); | 1711 | mNewSubTodoAction->setEnabled( false ); |
1711 | } | 1712 | } |
1712 | } | 1713 | } |
1713 | 1714 | ||
1714 | void MainWindow::enableIncidenceActions( bool enabled ) | 1715 | void MainWindow::enableIncidenceActions( bool enabled ) |
1715 | { | 1716 | { |
1716 | mShowAction->setEnabled( enabled ); | 1717 | mShowAction->setEnabled( enabled ); |
1717 | mEditAction->setEnabled( enabled ); | 1718 | mEditAction->setEnabled( enabled ); |
1718 | mDeleteAction->setEnabled( enabled ); | 1719 | mDeleteAction->setEnabled( enabled ); |
1719 | 1720 | ||
1720 | mCloneAction->setEnabled( enabled ); | 1721 | mCloneAction->setEnabled( enabled ); |
1721 | mMoveAction->setEnabled( enabled ); | 1722 | mMoveAction->setEnabled( enabled ); |
1722 | mBeamAction->setEnabled( enabled ); | 1723 | mBeamAction->setEnabled( enabled ); |
1723 | mCancelAction->setEnabled( enabled ); | 1724 | mCancelAction->setEnabled( enabled ); |
1724 | } | 1725 | } |
1725 | 1726 | ||
1726 | void MainWindow::importOL() | 1727 | void MainWindow::importOL() |
1727 | { | 1728 | { |
1728 | #ifdef _OL_IMPORT_ | 1729 | #ifdef _OL_IMPORT_ |
1729 | mView->clearAllViews(); | 1730 | mView->clearAllViews(); |
1730 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1731 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1731 | id->exec(); | 1732 | id->exec(); |
1732 | delete id; | 1733 | delete id; |
1733 | mView->calendar()->checkAlarmForIncidence( 0, true ); | 1734 | mView->calendar()->checkAlarmForIncidence( 0, true ); |
1734 | mView->updateView(); | 1735 | mView->updateView(); |
1735 | #endif | 1736 | #endif |
1736 | } | 1737 | } |
1737 | void MainWindow::importBday() | 1738 | void MainWindow::importBday() |
1738 | { | 1739 | { |
1739 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), | 1740 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), |
1740 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1741 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1741 | i18n("Import!"), i18n("Cancel"), 0, | 1742 | i18n("Import!"), i18n("Cancel"), 0, |
1742 | 0, 1 ); | 1743 | 0, 1 ); |
1743 | if ( result == 0 ) { | 1744 | if ( result == 0 ) { |
1744 | mView->importBday(); | 1745 | mView->importBday(); |
1745 | 1746 | ||
1746 | } | 1747 | } |
1747 | 1748 | ||
1748 | 1749 | ||
1749 | } | 1750 | } |
1750 | void MainWindow::importQtopia() | 1751 | void MainWindow::importQtopia() |
1751 | { | 1752 | { |
1752 | //#ifndef DESKTOP_VERSION | 1753 | //#ifndef DESKTOP_VERSION |
1753 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); | 1754 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); |
1754 | #ifdef DESKTOP_VERSION | 1755 | #ifdef DESKTOP_VERSION |
1755 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1756 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1756 | #endif | 1757 | #endif |
1757 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1758 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1758 | i18n("Import!"), i18n("Cancel"), 0, | 1759 | i18n("Import!"), i18n("Cancel"), 0, |
1759 | 0, 1 ); | 1760 | 0, 1 ); |
1760 | if ( result == 0 ) { | 1761 | if ( result == 0 ) { |
1761 | #ifndef DESKTOP_VERSION | 1762 | #ifndef DESKTOP_VERSION |
1762 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1763 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1763 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1764 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1764 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1765 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1765 | #else | 1766 | #else |
1766 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1767 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1767 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1768 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1768 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1769 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1769 | #endif | 1770 | #endif |
1770 | mView->importQtopia( categories, datebook, todolist ); | 1771 | mView->importQtopia( categories, datebook, todolist ); |
1771 | } | 1772 | } |
1772 | mView->calendar()->reInitAlarmSettings(); | 1773 | mView->calendar()->reInitAlarmSettings(); |
1773 | #if 0 | 1774 | #if 0 |
1774 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1775 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1775 | i18n("Not supported \non desktop!\n"), | 1776 | i18n("Not supported \non desktop!\n"), |
1776 | i18n("Ok"), i18n("Cancel"), 0, | 1777 | i18n("Ok"), i18n("Cancel"), 0, |
1777 | 0, 1 ); | 1778 | 0, 1 ); |
1778 | 1779 | ||
1779 | #endif | 1780 | #endif |
1780 | } | 1781 | } |
1781 | 1782 | ||
1782 | void MainWindow::saveOnClose() | 1783 | void MainWindow::saveOnClose() |
1783 | { | 1784 | { |
1784 | KOPrefs *p = KOPrefs::instance(); | 1785 | KOPrefs *p = KOPrefs::instance(); |
1785 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1786 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1786 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1787 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1787 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1788 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1788 | if ( filterToolBar ) { | 1789 | if ( filterToolBar ) { |
1789 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1790 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1790 | } | 1791 | } |
1791 | #ifdef DESKTOP_VERSION | 1792 | #ifdef DESKTOP_VERSION |
1792 | 1793 | ||
1793 | QPoint myP; | 1794 | QPoint myP; |
1794 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1795 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1795 | if ( p->mToolBarHor ) | 1796 | if ( p->mToolBarHor ) |
1796 | p->mToolBarUp = myP.y() > height()/2; | 1797 | p->mToolBarUp = myP.y() > height()/2; |
1797 | else | 1798 | else |
1798 | p->mToolBarUp = myP.x() > width()/2; | 1799 | p->mToolBarUp = myP.x() > width()/2; |
1799 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1800 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1800 | if ( p->mToolBarHorV ) | 1801 | if ( p->mToolBarHorV ) |
1801 | p->mToolBarUpV = myP.y() > height()/2; | 1802 | p->mToolBarUpV = myP.y() > height()/2; |
1802 | else | 1803 | else |
1803 | p->mToolBarUpV = myP.x() > width()/2 ; | 1804 | p->mToolBarUpV = myP.x() > width()/2 ; |
1804 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1805 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1805 | if ( p->mToolBarHorN ) | 1806 | if ( p->mToolBarHorN ) |
1806 | p->mToolBarUpN = myP.y() > height()/2; | 1807 | p->mToolBarUpN = myP.y() > height()/2; |
1807 | else | 1808 | else |
1808 | p->mToolBarUpN = myP.x() > width()/2 ; | 1809 | p->mToolBarUpN = myP.x() > width()/2 ; |
1809 | if ( filterToolBar ) { | 1810 | if ( filterToolBar ) { |
1810 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1811 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1811 | if ( p->mToolBarHorF ) | 1812 | if ( p->mToolBarHorF ) |
1812 | p->mToolBarUpF = myP.y() > height()/2; | 1813 | p->mToolBarUpF = myP.y() > height()/2; |
1813 | else | 1814 | else |
1814 | p->mToolBarUpF = myP.x() > width()/2 ; | 1815 | p->mToolBarUpF = myP.x() > width()/2 ; |
1815 | } | 1816 | } |
1816 | #else | 1817 | #else |
1817 | if ( p->mToolBarHor ) | 1818 | if ( p->mToolBarHor ) |
1818 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1819 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1819 | else | 1820 | else |
1820 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1821 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1821 | if ( p->mToolBarHorV ) | 1822 | if ( p->mToolBarHorV ) |
1822 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1823 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1823 | else | 1824 | else |
1824 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1825 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1825 | 1826 | ||
1826 | if ( p->mToolBarHorN ) | 1827 | if ( p->mToolBarHorN ) |
1827 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1828 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1828 | else | 1829 | else |
1829 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1830 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1830 | if ( filterToolBar ) { | 1831 | if ( filterToolBar ) { |
1831 | if ( p->mToolBarHorF ) | 1832 | if ( p->mToolBarHorF ) |
1832 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1833 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1833 | else | 1834 | else |
1834 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1835 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1835 | } | 1836 | } |
1836 | #endif | 1837 | #endif |
1837 | 1838 | if ( mView->viewManager()->journalView() ) | |
1839 | mView->viewManager()->journalView()->checkModified(); | ||
1838 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1840 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1839 | save(); | 1841 | save(); |
1840 | mView->writeSettings(); | 1842 | mView->writeSettings(); |
1841 | } | 1843 | } |
1842 | void MainWindow::slotModifiedChanged( bool changed ) | 1844 | void MainWindow::slotModifiedChanged( bool changed ) |
1843 | { | 1845 | { |
1844 | if ( mBlockAtStartup ) | 1846 | if ( mBlockAtStartup ) |
1845 | return; | 1847 | return; |
1846 | 1848 | ||
1847 | int msec; | 1849 | int msec; |
1848 | // we store the changes after 1 minute, | 1850 | // we store the changes after 1 minute, |
1849 | // and for safety reasons after 10 minutes again | 1851 | // and for safety reasons after 10 minutes again |
1850 | if ( !mSyncManager->blockSave() ) | 1852 | if ( !mSyncManager->blockSave() ) |
1851 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1853 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1852 | else | 1854 | else |
1853 | msec = 1000 * 600; | 1855 | msec = 1000 * 600; |
1854 | mSaveTimer.start( msec, true ); // 1 minute | 1856 | mSaveTimer.start( msec, true ); // 1 minute |
1855 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1857 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1856 | mCalendarModifiedFlag = true; | 1858 | mCalendarModifiedFlag = true; |
1857 | } | 1859 | } |
1858 | void MainWindow::saveStopTimer() | 1860 | void MainWindow::saveStopTimer() |
1859 | { | 1861 | { |
1860 | mSaveTimer.stop(); | 1862 | mSaveTimer.stop(); |
1861 | } | 1863 | } |
1862 | void MainWindow::backupAllFiles() | 1864 | void MainWindow::backupAllFiles() |
1863 | { | 1865 | { |
1864 | QDate reference ( 2000,1,1); | 1866 | QDate reference ( 2000,1,1); |
1865 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1867 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1866 | setCaption(i18n("Creating backup ... please wait ..." )); | 1868 | setCaption(i18n("Creating backup ... please wait ..." )); |
1867 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 1869 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
1868 | // we need the file path, the backup dir and the number of bups as param | 1870 | // we need the file path, the backup dir and the number of bups as param |
1869 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 1871 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
1870 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 1872 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
1871 | bupDir = KGlobalSettings::backupDataDir(); | 1873 | bupDir = KGlobalSettings::backupDataDir(); |
1872 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1874 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1873 | if ( retval == 0 ) { | 1875 | if ( retval == 0 ) { |
1874 | setCaption(i18n("Backup cancelled" )); | 1876 | setCaption(i18n("Backup cancelled" )); |
1875 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 1877 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
1876 | // retval == 0 : backup skipped for today, try again tomorrow | 1878 | // retval == 0 : backup skipped for today, try again tomorrow |
1877 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 1879 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
1878 | } else if ( retval == 1 ){ | 1880 | } else if ( retval == 1 ){ |
1879 | qDebug("KO: Backup created."); | 1881 | qDebug("KO: Backup created."); |
1880 | // backup ok | 1882 | // backup ok |
1881 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1883 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1882 | KopiCalendarFile * cal = calendars.first(); | 1884 | KopiCalendarFile * cal = calendars.first(); |
1883 | cal = calendars.next(); | 1885 | cal = calendars.next(); |
1884 | while ( cal ) { | 1886 | while ( cal ) { |
1885 | if ( !cal->mErrorOnLoad ) { | 1887 | if ( !cal->mErrorOnLoad ) { |
1886 | int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1888 | int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1887 | } | 1889 | } |
1888 | cal = calendars.next(); | 1890 | cal = calendars.next(); |
1889 | } | 1891 | } |
1890 | KOPrefs::instance()->mLastBackupDate = daysTo; | 1892 | KOPrefs::instance()->mLastBackupDate = daysTo; |
1891 | setCaption(i18n("Backup succesfully finished" )); | 1893 | setCaption(i18n("Backup succesfully finished" )); |
1892 | } else if ( retval == 2 ){ | 1894 | } else if ( retval == 2 ){ |
1893 | setCaption(i18n("Backup globally disabled" )); | 1895 | setCaption(i18n("Backup globally disabled" )); |
1894 | qDebug("KO: Backup globally cancelled."); | 1896 | qDebug("KO: Backup globally cancelled."); |
1895 | // backup globally cancelled | 1897 | // backup globally cancelled |
1896 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 1898 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
1897 | } | 1899 | } |
1898 | // retval == 3: do nothing, try again later | 1900 | // retval == 3: do nothing, try again later |
1899 | } | 1901 | } |
1900 | void MainWindow::save() | 1902 | void MainWindow::save() |
1901 | { | 1903 | { |
1904 | if ( mView->viewManager()->journalView() ) | ||
1905 | mView->viewManager()->journalView()->checkModified(); | ||
1902 | if ( !mCalendarModifiedFlag ) { | 1906 | if ( !mCalendarModifiedFlag ) { |
1903 | qDebug("KO: Calendar not modified. Nothing saved."); | 1907 | qDebug("KO: Calendar not modified. Nothing saved."); |
1904 | return; | 1908 | return; |
1905 | } | 1909 | } |
1906 | if ( mSyncManager->blockSave() ) | 1910 | if ( mSyncManager->blockSave() ) |
1907 | return; | 1911 | return; |
1908 | mSyncManager->setBlockSave(true); | 1912 | mSyncManager->setBlockSave(true); |
1909 | if ( mView->checkAllFileVersions() ) { | 1913 | if ( mView->checkAllFileVersions() ) { |
1910 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 1914 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
1911 | QDate reference ( 2000,1,1); | 1915 | QDate reference ( 2000,1,1); |
1912 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1916 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1913 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 1917 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
1914 | backupAllFiles(); | 1918 | backupAllFiles(); |
1915 | } | 1919 | } |
1916 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 1920 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
1917 | } | 1921 | } |
1918 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1922 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1919 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1923 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1920 | qDebug("KO: Start saving data to file!"); | 1924 | qDebug("KO: Start saving data to file!"); |
1921 | mView->saveCalendars(); | 1925 | mView->saveCalendars(); |
1922 | mCalendarModifiedFlag = false; | 1926 | mCalendarModifiedFlag = false; |
1923 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1927 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1924 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1928 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1925 | QString savemes; | 1929 | QString savemes; |
1926 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1930 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1927 | setCaption(savemes); | 1931 | setCaption(savemes); |
1928 | } else | 1932 | } else |
1929 | setCaption(i18n("Saving cancelled!")); | 1933 | setCaption(i18n("Saving cancelled!")); |
1930 | mSyncManager->setBlockSave( false ); | 1934 | mSyncManager->setBlockSave( false ); |
1931 | } | 1935 | } |
1932 | 1936 | ||
1933 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1937 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1934 | { | 1938 | { |
1935 | if ( !e->isAutoRepeat() ) { | 1939 | if ( !e->isAutoRepeat() ) { |
1936 | mFlagKeyPressed = false; | 1940 | mFlagKeyPressed = false; |
1937 | } | 1941 | } |
1938 | } | 1942 | } |
1939 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1943 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1940 | { | 1944 | { |
1941 | qApp->processEvents(); | 1945 | qApp->processEvents(); |
1942 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1946 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1943 | e->ignore(); | 1947 | e->ignore(); |
1944 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1948 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1945 | return; | 1949 | return; |
1946 | } | 1950 | } |
1947 | if (! e->isAutoRepeat() ) | 1951 | if (! e->isAutoRepeat() ) |
1948 | mFlagKeyPressed = true; | 1952 | mFlagKeyPressed = true; |
1949 | KOPrefs *p = KOPrefs::instance(); | 1953 | KOPrefs *p = KOPrefs::instance(); |
1950 | bool showSelectedDates = false; | 1954 | bool showSelectedDates = false; |
1951 | int size; | 1955 | int size; |
1952 | int pro = 0; | 1956 | int pro = 0; |
1953 | //qDebug("MainWindow::keyPressEvent "); | 1957 | //qDebug("MainWindow::keyPressEvent "); |
1954 | switch ( e->key() ) { | 1958 | switch ( e->key() ) { |
1955 | case Qt::Key_Right: | 1959 | case Qt::Key_Right: |
1956 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1960 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1957 | mView->goNextMonth(); | 1961 | mView->goNextMonth(); |
1958 | else | 1962 | else |
1959 | mView->goNext(); | 1963 | mView->goNext(); |
1960 | showSelectedDates = true; | 1964 | showSelectedDates = true; |
1961 | break; | 1965 | break; |
1962 | case Qt::Key_Left: | 1966 | case Qt::Key_Left: |
1963 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1967 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1964 | mView->goPreviousMonth(); | 1968 | mView->goPreviousMonth(); |
1965 | else | 1969 | else |
1966 | mView->goPrevious(); | 1970 | mView->goPrevious(); |
1967 | showSelectedDates = true; | 1971 | showSelectedDates = true; |
1968 | break; | 1972 | break; |
1969 | case Qt::Key_Down: | 1973 | case Qt::Key_Down: |
1970 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1974 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1971 | break; | 1975 | break; |
1972 | case Qt::Key_Up: | 1976 | case Qt::Key_Up: |
1973 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1977 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1974 | break; | 1978 | break; |
1975 | case Qt::Key_K: | 1979 | case Qt::Key_K: |
1976 | mView->viewManager()->showMonthViewWeek(); | 1980 | mView->viewManager()->showMonthViewWeek(); |
1977 | break; | 1981 | break; |
1978 | case Qt::Key_I: | 1982 | case Qt::Key_I: |
1979 | mView->showIncidence(); | 1983 | mView->showIncidence(); |
1980 | break; | 1984 | break; |
1981 | case Qt::Key_Delete: | 1985 | case Qt::Key_Delete: |
1982 | case Qt::Key_Backspace: | 1986 | case Qt::Key_Backspace: |
1983 | mView->deleteIncidence(); | 1987 | mView->deleteIncidence(); |
1984 | break; | 1988 | break; |
1985 | case Qt::Key_D: | 1989 | case Qt::Key_D: |
1986 | mView->viewManager()->showDayView(); | 1990 | mView->viewManager()->showDayView(); |
1987 | showSelectedDates = true; | 1991 | showSelectedDates = true; |
1988 | break; | 1992 | break; |
1989 | case Qt::Key_O: | 1993 | case Qt::Key_O: |
1990 | mView->toggleFilerEnabled( ); | 1994 | mView->toggleFilerEnabled( ); |
1991 | break; | 1995 | break; |
1992 | case Qt::Key_0: | 1996 | case Qt::Key_0: |
1993 | case Qt::Key_1: | 1997 | case Qt::Key_1: |
1994 | case Qt::Key_2: | 1998 | case Qt::Key_2: |
1995 | case Qt::Key_3: | 1999 | case Qt::Key_3: |
1996 | case Qt::Key_4: | 2000 | case Qt::Key_4: |
1997 | case Qt::Key_5: | 2001 | case Qt::Key_5: |
1998 | case Qt::Key_6: | 2002 | case Qt::Key_6: |
1999 | case Qt::Key_7: | 2003 | case Qt::Key_7: |
2000 | case Qt::Key_8: | 2004 | case Qt::Key_8: |
2001 | case Qt::Key_9: | 2005 | case Qt::Key_9: |
2002 | pro = e->key()-48; | 2006 | pro = e->key()-48; |
2003 | if ( pro == 0 ) | 2007 | if ( pro == 0 ) |
2004 | pro = 10; | 2008 | pro = 10; |
2005 | if ( e->state() == Qt::ControlButton) | 2009 | if ( e->state() == Qt::ControlButton) |
2006 | pro += 10; | 2010 | pro += 10; |
2007 | break; | 2011 | break; |
2008 | case Qt::Key_M: | 2012 | case Qt::Key_M: |
2009 | mView->viewManager()->showMonthView(); | 2013 | mView->viewManager()->showMonthView(); |
2010 | showSelectedDates = true; | 2014 | showSelectedDates = true; |
2011 | break; | 2015 | break; |
2012 | case Qt::Key_Insert: | 2016 | case Qt::Key_Insert: |
2013 | mView->newEvent(); | 2017 | mView->newEvent(); |
2014 | break; | 2018 | break; |
2015 | case Qt::Key_S : | 2019 | case Qt::Key_S : |
2016 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2020 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2017 | mView->newSubTodo(); | 2021 | mView->newSubTodo(); |
2018 | else | 2022 | else |
2019 | mView->dialogManager()->showSearchDialog(); | 2023 | mView->dialogManager()->showSearchDialog(); |
2020 | break; | 2024 | break; |
2021 | case Qt::Key_Y : | 2025 | case Qt::Key_Y : |
2022 | case Qt::Key_Z : | 2026 | case Qt::Key_Z : |
2023 | mView->viewManager()->showWorkWeekView(); | 2027 | mView->viewManager()->showWorkWeekView(); |
2024 | showSelectedDates = true; | 2028 | showSelectedDates = true; |
2025 | break; | 2029 | break; |
2026 | case Qt::Key_U : | 2030 | case Qt::Key_U : |
2027 | mView->viewManager()->showWeekView(); | 2031 | mView->viewManager()->showWeekView(); |
2028 | showSelectedDates = true; | 2032 | showSelectedDates = true; |
2029 | break; | 2033 | break; |
2030 | case Qt::Key_H : | 2034 | case Qt::Key_H : |
2031 | keyBindings(); | 2035 | keyBindings(); |
2032 | break; | 2036 | break; |
2033 | case Qt::Key_W: | 2037 | case Qt::Key_W: |
2034 | mView->viewManager()->showWhatsNextView(); | 2038 | mView->viewManager()->showWhatsNextView(); |
2035 | break; | 2039 | break; |
2036 | case Qt::Key_L: | 2040 | case Qt::Key_L: |
2037 | mView->viewManager()->showListView(); | 2041 | mView->viewManager()->showListView(); |
2038 | break; | 2042 | break; |
2039 | case Qt::Key_N: | 2043 | case Qt::Key_N: |
2040 | mView->viewManager()->showNextView(); | 2044 | mView->viewManager()->showNextView(); |
2041 | break; | 2045 | break; |
2042 | case Qt::Key_V: | 2046 | case Qt::Key_V: |
2043 | mView->viewManager()->showTodoView(); | 2047 | mView->viewManager()->showTodoView(); |
2044 | break; | 2048 | break; |
2045 | case Qt::Key_C: | 2049 | case Qt::Key_C: |
2046 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 2050 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
2047 | break; | 2051 | break; |
2048 | case Qt::Key_P: | 2052 | case Qt::Key_P: |
2049 | mView->showDatePicker( ); | 2053 | mView->showDatePicker( ); |
2050 | break; | 2054 | break; |
2051 | case Qt::Key_F: | 2055 | case Qt::Key_F: |
2052 | mView->editFilters(); | 2056 | mView->editFilters(); |
2053 | break; | 2057 | break; |
2054 | case Qt::Key_R: | 2058 | case Qt::Key_R: |
2055 | mView->toggleFilter(); | 2059 | mView->toggleFilter(); |
2056 | break; | 2060 | break; |
2057 | case Qt::Key_X: | 2061 | case Qt::Key_X: |
2058 | if ( e->state() == Qt::ControlButton ) | 2062 | if ( e->state() == Qt::ControlButton ) |
2059 | mView->toggleDateNavigatorWidget(); | 2063 | mView->toggleDateNavigatorWidget(); |
2060 | else { | 2064 | else { |
2061 | mView->viewManager()->showNextXView(); | 2065 | mView->viewManager()->showNextXView(); |
2062 | showSelectedDates = true; | 2066 | showSelectedDates = true; |
2063 | } | 2067 | } |
2064 | break; | 2068 | break; |
2065 | case Qt::Key_Space: | 2069 | case Qt::Key_Space: |
2066 | mView->toggleExpand(); | 2070 | mView->toggleExpand(); |
2067 | break; | 2071 | break; |
2068 | case Qt::Key_A: | 2072 | case Qt::Key_A: |
2069 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) | 2073 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) |
2070 | mView->showNextAlarms(); | 2074 | mView->showNextAlarms(); |
2071 | else | 2075 | else |
2072 | mView->toggleAllDaySize(); | 2076 | mView->toggleAllDaySize(); |
2073 | break; | 2077 | break; |
2074 | case Qt::Key_T: | 2078 | case Qt::Key_T: |
2075 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2079 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2076 | mView->newTodo(); | 2080 | mView->newTodo(); |
2077 | else { | 2081 | else { |
2078 | mView->goToday(); | 2082 | mView->goToday(); |
2079 | showSelectedDates = true; | 2083 | showSelectedDates = true; |
2080 | } | 2084 | } |
2081 | break; | 2085 | break; |
2082 | case Qt::Key_J: | 2086 | case Qt::Key_J: |
2083 | mView->viewManager()->showJournalView(); | 2087 | mView->viewManager()->showJournalView(); |
2084 | break; | 2088 | break; |
2085 | case Qt::Key_B: | 2089 | case Qt::Key_B: |
2086 | mView->editIncidenceDescription();; | 2090 | mView->editIncidenceDescription();; |
2087 | break; | 2091 | break; |
2088 | // case Qt::Key_Return: | 2092 | // case Qt::Key_Return: |
2089 | case Qt::Key_E: | 2093 | case Qt::Key_E: |
2090 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2094 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2091 | mView->newEvent(); | 2095 | mView->newEvent(); |
2092 | else | 2096 | else |
2093 | mView->editIncidence(); | 2097 | mView->editIncidence(); |
2094 | break; | 2098 | break; |
2095 | case Qt::Key_Plus: | 2099 | case Qt::Key_Plus: |
2096 | size = p->mHourSize +2; | 2100 | size = p->mHourSize +2; |
2097 | if ( size <= 22 ) | 2101 | if ( size <= 22 ) |
2098 | configureAgenda( size ); | 2102 | configureAgenda( size ); |
2099 | break; | 2103 | break; |
2100 | case Qt::Key_Minus: | 2104 | case Qt::Key_Minus: |
2101 | size = p->mHourSize - 2; | 2105 | size = p->mHourSize - 2; |
2102 | if ( size >= 4 ) | 2106 | if ( size >= 4 ) |
2103 | configureAgenda( size ); | 2107 | configureAgenda( size ); |
2104 | break; | 2108 | break; |
2105 | 2109 | ||
2106 | 2110 | ||
2107 | default: | 2111 | default: |
2108 | e->ignore(); | 2112 | e->ignore(); |
2109 | } | 2113 | } |
2110 | if ( pro > 0 ) { | 2114 | if ( pro > 0 ) { |
2111 | selectFilter( pro+1 ); | 2115 | selectFilter( pro+1 ); |
2112 | } | 2116 | } |
2113 | if ( showSelectedDates ) { | 2117 | if ( showSelectedDates ) { |
2114 | ;// setCaptionToDates(); | 2118 | ;// setCaptionToDates(); |
2115 | } | 2119 | } |
2116 | 2120 | ||
2117 | } | 2121 | } |
2118 | void MainWindow::fillFilterMenuTB() | 2122 | void MainWindow::fillFilterMenuTB() |
2119 | { | 2123 | { |
2120 | selectFilterMenuTB->clear(); | 2124 | selectFilterMenuTB->clear(); |
2121 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); | 2125 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); |
2122 | selectFilterMenuTB->insertSeparator(); | 2126 | selectFilterMenuTB->insertSeparator(); |
2123 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); | 2127 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); |
2124 | 2128 | ||
2125 | selectFilterMenuTB->insertSeparator(); | 2129 | selectFilterMenuTB->insertSeparator(); |
2126 | QPtrList<CalFilter> fili = mView->filters(); | 2130 | QPtrList<CalFilter> fili = mView->filters(); |
2127 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2131 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2128 | CalFilter *filter = fili.first(); | 2132 | CalFilter *filter = fili.first(); |
2129 | int iii = 2; | 2133 | int iii = 2; |
2130 | bool checkitem = mView->filterView()->filtersEnabled(); | 2134 | bool checkitem = mView->filterView()->filtersEnabled(); |
2131 | while(filter) { | 2135 | while(filter) { |
2132 | selectFilterMenuTB->insertItem( filter->name(), iii ); | 2136 | selectFilterMenuTB->insertItem( filter->name(), iii ); |
2133 | if ( filter == curfilter) | 2137 | if ( filter == curfilter) |
2134 | selectFilterMenuTB->setItemChecked( iii, checkitem ); | 2138 | selectFilterMenuTB->setItemChecked( iii, checkitem ); |
2135 | filter = fili.next(); | 2139 | filter = fili.next(); |
2136 | ++iii; | 2140 | ++iii; |
2137 | } | 2141 | } |
2138 | if ( !checkitem ) | 2142 | if ( !checkitem ) |
2139 | selectFilterMenuTB->setItemChecked( 1, true ); | 2143 | selectFilterMenuTB->setItemChecked( 1, true ); |
2140 | 2144 | ||
2141 | int x = 0; | 2145 | int x = 0; |
2142 | int y = iconToolBar->height(); | 2146 | int y = iconToolBar->height(); |
2143 | int dX = 0; | 2147 | int dX = 0; |
2144 | int dY = 0; | 2148 | int dY = 0; |
2145 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2149 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2146 | if ( iconToolBar->y() > height()/2 ) { | 2150 | if ( iconToolBar->y() > height()/2 ) { |
2147 | dY = selectFilterMenuTB->sizeHint().height()+8; | 2151 | dY = selectFilterMenuTB->sizeHint().height()+8; |
2148 | y = 0; | 2152 | y = 0; |
2149 | } | 2153 | } |
2150 | } else { | 2154 | } else { |
2151 | if ( iconToolBar->x() > width()/2 ) { // right side | 2155 | if ( iconToolBar->x() > width()/2 ) { // right side |
2152 | x=0; | 2156 | x=0; |
2153 | dX= selectFilterMenuTB->sizeHint().width()+8; | 2157 | dX= selectFilterMenuTB->sizeHint().width()+8; |
2154 | y = 0; | 2158 | y = 0; |
2155 | } else { | 2159 | } else { |
2156 | x= iconToolBar->width(); | 2160 | x= iconToolBar->width(); |
2157 | y = 0; | 2161 | y = 0; |
2158 | } | 2162 | } |
2159 | } | 2163 | } |
2160 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2164 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2161 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); | 2165 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); |
2162 | } | 2166 | } |
2163 | void MainWindow::fillFilterMenu() | 2167 | void MainWindow::fillFilterMenu() |
2164 | { | 2168 | { |
2165 | selectFilterMenu->clear(); | 2169 | selectFilterMenu->clear(); |
2166 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 2170 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
2167 | selectFilterMenu->insertSeparator(); | 2171 | selectFilterMenu->insertSeparator(); |
2168 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); | 2172 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); |
2169 | 2173 | ||
2170 | selectFilterMenu->insertSeparator(); | 2174 | selectFilterMenu->insertSeparator(); |
2171 | QPtrList<CalFilter> fili = mView->filters(); | 2175 | QPtrList<CalFilter> fili = mView->filters(); |
2172 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2176 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2173 | CalFilter *filter = fili.first(); | 2177 | CalFilter *filter = fili.first(); |
2174 | int iii = 2; | 2178 | int iii = 2; |
2175 | bool checkitem = mView->filterView()->filtersEnabled(); | 2179 | bool checkitem = mView->filterView()->filtersEnabled(); |
2176 | while(filter) { | 2180 | while(filter) { |
2177 | selectFilterMenu->insertItem( filter->name(), iii ); | 2181 | selectFilterMenu->insertItem( filter->name(), iii ); |
2178 | if ( filter == curfilter) | 2182 | if ( filter == curfilter) |
2179 | selectFilterMenu->setItemChecked( iii, checkitem ); | 2183 | selectFilterMenu->setItemChecked( iii, checkitem ); |
2180 | filter = fili.next(); | 2184 | filter = fili.next(); |
2181 | ++iii; | 2185 | ++iii; |
2182 | } | 2186 | } |
2183 | if ( !checkitem ) | 2187 | if ( !checkitem ) |
2184 | selectFilterMenu->setItemChecked( 1, true ); | 2188 | selectFilterMenu->setItemChecked( 1, true ); |
2185 | } | 2189 | } |
2186 | void MainWindow::fillFilterMenuPopup() | 2190 | void MainWindow::fillFilterMenuPopup() |
2187 | { | 2191 | { |
2188 | filterPopupMenu->clear(); | 2192 | filterPopupMenu->clear(); |
2189 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); | 2193 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); |
2190 | 2194 | ||
2191 | filterPopupMenu->insertSeparator(); | 2195 | filterPopupMenu->insertSeparator(); |
2192 | QPtrList<CalFilter> fili = mView->filters(); | 2196 | QPtrList<CalFilter> fili = mView->filters(); |
2193 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2197 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2194 | CalFilter *filter = fili.first(); | 2198 | CalFilter *filter = fili.first(); |
2195 | int iii = 1; | 2199 | int iii = 1; |
2196 | bool checkitem = mView->filterView()->filtersEnabled(); | 2200 | bool checkitem = mView->filterView()->filtersEnabled(); |
2197 | while(filter) { | 2201 | while(filter) { |
2198 | filterPopupMenu->insertItem( filter->name(), iii ); | 2202 | filterPopupMenu->insertItem( filter->name(), iii ); |
2199 | if ( filter == curfilter) | 2203 | if ( filter == curfilter) |
2200 | filterPopupMenu->setItemChecked( iii, checkitem ); | 2204 | filterPopupMenu->setItemChecked( iii, checkitem ); |
2201 | filter = fili.next(); | 2205 | filter = fili.next(); |
2202 | ++iii; | 2206 | ++iii; |
2203 | } | 2207 | } |
2204 | if ( !checkitem ) | 2208 | if ( !checkitem ) |
2205 | filterPopupMenu->setItemChecked( 0, true ); | 2209 | filterPopupMenu->setItemChecked( 0, true ); |
2206 | } | 2210 | } |
2207 | void MainWindow::selectFilter( int fil ) | 2211 | void MainWindow::selectFilter( int fil ) |
2208 | { | 2212 | { |
2209 | 2213 | ||
2210 | if ( fil == 0 ) { | 2214 | if ( fil == 0 ) { |
2211 | mView->editFilters( ); | 2215 | mView->editFilters( ); |
2212 | } else if ( fil == 1 ){ | 2216 | } else if ( fil == 1 ){ |
2213 | if ( mView->filterView()->filtersEnabled() ) | 2217 | if ( mView->filterView()->filtersEnabled() ) |
2214 | mView->toggleFilerEnabled( ); | 2218 | mView->toggleFilerEnabled( ); |
2215 | } else { | 2219 | } else { |
2216 | if ( !mView->filterView()->filtersEnabled() ) { | 2220 | if ( !mView->filterView()->filtersEnabled() ) { |
2217 | mView->filterView()->blockSignals( true ); | 2221 | mView->filterView()->blockSignals( true ); |
2218 | mView->toggleFilerEnabled( ); | 2222 | mView->toggleFilerEnabled( ); |
2219 | mView->filterView()->blockSignals( false ); | 2223 | mView->filterView()->blockSignals( false ); |
2220 | } | 2224 | } |
2221 | mView->selectFilter( fil-2 ); | 2225 | mView->selectFilter( fil-2 ); |
2222 | } | 2226 | } |
2223 | } | 2227 | } |
2224 | void MainWindow::updateFilterToolbar() | 2228 | void MainWindow::updateFilterToolbar() |
2225 | { | 2229 | { |
2226 | if ( filterMenubar ) { | 2230 | if ( filterMenubar ) { |
2227 | if ( !mView->filterView()->filtersEnabled() ) { | 2231 | if ( !mView->filterView()->filtersEnabled() ) { |
2228 | filterMenubar->changeItem( 0, i18n("No Filter") ); | 2232 | filterMenubar->changeItem( 0, i18n("No Filter") ); |
2229 | } else { | 2233 | } else { |
2230 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2234 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2231 | if ( curfilter ) { | 2235 | if ( curfilter ) { |
2232 | filterMenubar->changeItem( 0, curfilter->name() ); | 2236 | filterMenubar->changeItem( 0, curfilter->name() ); |
2233 | } | 2237 | } |
2234 | } | 2238 | } |
2235 | } | 2239 | } |
2236 | } | 2240 | } |
2237 | void MainWindow::selectFilterPopup( int fil ) | 2241 | void MainWindow::selectFilterPopup( int fil ) |
2238 | { | 2242 | { |
2239 | selectFilter( fil + 1 ); | 2243 | selectFilter( fil + 1 ); |
2240 | 2244 | ||
2241 | } | 2245 | } |
2242 | void MainWindow::configureToolBar( int item ) | 2246 | void MainWindow::configureToolBar( int item ) |
2243 | { | 2247 | { |
2244 | 2248 | ||
2245 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 2249 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
2246 | KOPrefs *p = KOPrefs::instance(); | 2250 | KOPrefs *p = KOPrefs::instance(); |
2247 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 2251 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
2248 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); | 2252 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); |
2249 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); | 2253 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); |
2250 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 2254 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
2251 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 2255 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
2252 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); | 2256 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); |
2253 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); | 2257 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); |
2254 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); | 2258 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); |
2255 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); | 2259 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); |
2256 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 2260 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
2257 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 2261 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
2258 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 2262 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
2259 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 2263 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
2260 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 2264 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
2261 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 2265 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
2262 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 2266 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
2263 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 2267 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
2264 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 2268 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
2265 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 2269 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
2266 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 2270 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
2267 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 2271 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
2268 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 2272 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
2269 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 2273 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
2270 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 2274 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
2271 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 2275 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
2272 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 2276 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
2273 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 2277 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
2274 | // initActions(); | 2278 | // initActions(); |
2275 | } | 2279 | } |
2276 | void MainWindow::setCaption ( const QString & c ) | 2280 | void MainWindow::setCaption ( const QString & c ) |
2277 | { | 2281 | { |
2278 | QString cap = c; | 2282 | QString cap = c; |
2279 | cap.replace( QRegExp("\n"), " " ); | 2283 | cap.replace( QRegExp("\n"), " " ); |
2280 | cap = cap.stripWhiteSpace(); | 2284 | cap = cap.stripWhiteSpace(); |
2281 | if ( cap.isEmpty() ) | 2285 | if ( cap.isEmpty() ) |
2282 | cap = "KO/Pi"; | 2286 | cap = "KO/Pi"; |
2283 | QWidget::setCaption( cap ); | 2287 | QWidget::setCaption( cap ); |
2284 | } | 2288 | } |
2285 | void MainWindow::setCaptionToDates() | 2289 | void MainWindow::setCaptionToDates() |