summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp7
-rw-r--r--korganizer/kojournalview.cpp6
-rw-r--r--korganizer/kojournalview.h1
-rw-r--r--korganizer/koviewmanager.h1
-rw-r--r--korganizer/mainwindow.cpp6
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
57JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : 57JournalEntry::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
106JournalEntry::~JournalEntry() 106JournalEntry::~JournalEntry()
107{ 107{
108 //qDebug("JournalEntry::~JournalEntry() "); 108 //qDebug("JournalEntry::~JournalEntry() ");
109} 109}
110QSize JournalEntry::sizeHint() const 110QSize JournalEntry::sizeHint() const
111{ 111{
112 return QSize ( 240, heiHint ); 112 return QSize ( 240, heiHint );
113} 113}
114void JournalEntry::slotSaveTemplate() 114void 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}
137void JournalEntry::slotLoadTemplate() 137void 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}
162void JournalEntry::setDate(const QDate &date) 162void 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
172void JournalEntry::toggleShowJournal() 172void 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}
184void JournalEntry::setShowOnly() 184void JournalEntry::setShowOnly()
185{ 185{
186 showOnlyMode = true; 186 showOnlyMode = true;
187 mEditor->setFocus(); 187 mEditor->setFocus();
188 visibleMode = true; 188 visibleMode = true;
189} 189}
190void JournalEntry::setJournal(Journal *journal) 190void 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
209Journal *JournalEntry::journal() const 209Journal *JournalEntry::journal() const
210{ 210{
211 return mJournal; 211 return mJournal;
212} 212}
213 213
214 214
215void JournalEntry::clear() 215void 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
222bool JournalEntry::eventFilter( QObject *o, QEvent *e ) 222bool 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
240void JournalEntry::writeJournal() 240void 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
267void JournalEntry::flushEntry() 268void JournalEntry::flushEntry()
268{ 269{
269 writeJournal(); 270 writeJournal();
270} 271}
271void JournalEntry::keyPressEvent ( QKeyEvent * e ) 272void 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"
46using namespace KOrg; 46using namespace KOrg;
47 47
48KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, 48KOJournalView::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
78KOJournalView::~KOJournalView() 78KOJournalView::~KOJournalView()
79{ 79{
80} 80}
81 81
82int KOJournalView::currentDateCount() 82int KOJournalView::currentDateCount()
83{ 83{
84 return 0; 84 return 0;
85} 85}
86JournalEntry* KOJournalView::getNewEntry() 86JournalEntry* 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
98QPtrList<Incidence> KOJournalView::selectedIncidences() 98QPtrList<Incidence> KOJournalView::selectedIncidences()
99{ 99{
100 QPtrList<Incidence> eventList; 100 QPtrList<Incidence> eventList;
101 101
102 return eventList; 102 return eventList;
103} 103}
104void KOJournalView::updateConfig() 104void 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}
112void KOJournalView::updateView() 112void 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 121void KOJournalView::checkModified()
122{
123 qDebug("checkmod ");
124 flushView();
125}
122void KOJournalView::flushView() 126void 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
135void KOJournalView::clearList() 139void 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}
143void KOJournalView::newJournal() 147void 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
153void KOJournalView::showOnly ( Journal* j ) 157void 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}
167void KOJournalView::showList(QPtrList<Journal> jl) 171void 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
206void KOJournalView::showDates(const QDate &start, const QDate &) 210void 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
214void KOJournalView::showEvents(QPtrList<Event>) 218void 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
220void KOJournalView::changeEventDisplay(Event *, int /*action*/) 224void KOJournalView::changeEventDisplay(Event *, int /*action*/)
221{ 225{
222 updateView(); 226 updateView();
223} 227}
224 228
225void KOJournalView::keyPressEvent ( QKeyEvent * e ) 229void 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
29class JournalEntry; 29class JournalEntry;
30class QLabel; 30class 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 */
39class KOJournalView : public KOrg::BaseView 39class 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
31class CalendarView; 31class CalendarView;
32 32
33class KOListView; 33class KOListView;
34class KOAgendaView; 34class KOAgendaView;
35class KOMonthView; 35class KOMonthView;
36class KOTimeSpanView; 36class KOTimeSpanView;
37class KOTodoView; 37class KOTodoView;
38class KOWhatsNextView; 38class KOWhatsNextView;
39class KOJournalView; 39class KOJournalView;
40 40
41using namespace KCal; 41using 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*/
47class KOViewManager : public QObject 47class 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,2571 +1,2575 @@
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
66using namespace KCal; 67using 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
77class KOex2phonePrefs : public QDialog 78class 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
126public: 127public:
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
132QPixmap* sgListViewCompletedPix[6]; 133QPixmap* sgListViewCompletedPix[6];
133 134
134 135
135int globalFlagBlockStartup; 136int globalFlagBlockStartup;
136MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 137MainWindow::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}
410MainWindow::~MainWindow() 411MainWindow::~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
424void MainWindow::disableBR(bool b) 425void 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 {
434 if ( mBRdisabled ) { 435 if ( mBRdisabled ) {
435 mBRdisabled = false; 436 mBRdisabled = false;
436 //makes no sense,because other cal ap is probably running 437 //makes no sense,because other cal ap is probably running
437 // toggleBeamReceive(); 438 // toggleBeamReceive();
438 } 439 }
439 } 440 }
440#endif 441#endif
441 442
442} 443}
443bool MainWindow::beamReceiveEnabled() 444bool MainWindow::beamReceiveEnabled()
444{ 445{
445#ifndef DESKTOP_VERSION 446#ifndef DESKTOP_VERSION
446 return ( infrared != 0 ); 447 return ( infrared != 0 );
447#endif 448#endif
448 return false; 449 return false;
449} 450}
450 451
451void MainWindow::toggleBeamReceive() 452void MainWindow::toggleBeamReceive()
452{ 453{
453 if ( mBRdisabled ) 454 if ( mBRdisabled )
454 return; 455 return;
455#ifndef DESKTOP_VERSION 456#ifndef DESKTOP_VERSION
456 if ( infrared ) { 457 if ( infrared ) {
457 qDebug("KO: Disable BeamReceive "); 458 qDebug("KO: Disable BeamReceive ");
458 delete infrared; 459 delete infrared;
459 infrared = 0; 460 infrared = 0;
460 brAction->setOn(false); 461 brAction->setOn(false);
461 return; 462 return;
462 } 463 }
463 qDebug("KO: Enable BeamReceive "); 464 qDebug("KO: Enable BeamReceive ");
464 brAction->setOn(true); 465 brAction->setOn(true);
465 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 466 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
466 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 467 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
467#endif 468#endif
468} 469}
469void MainWindow::showMaximized () 470void MainWindow::showMaximized ()
470{ 471{
471#ifndef DESKTOP_VERSION 472#ifndef DESKTOP_VERSION
472 if ( ! globalFlagBlockStartup ) 473 if ( ! globalFlagBlockStartup )
473 if ( mClosed ) 474 if ( mClosed )
474 mView->goToday(); 475 mView->goToday();
475#endif 476#endif
476 QWidget::showMaximized () ; 477 QWidget::showMaximized () ;
477 mClosed = false; 478 mClosed = false;
478} 479}
479void MainWindow::closeEvent( QCloseEvent* ce ) 480void MainWindow::closeEvent( QCloseEvent* ce )
480{ 481{
481 482
482 483
483 484
484 if ( ! KOPrefs::instance()->mAskForQuit ) { 485 if ( ! KOPrefs::instance()->mAskForQuit ) {
485 saveOnClose(); 486 saveOnClose();
486 mClosed = true; 487 mClosed = true;
487 ce->accept(); 488 ce->accept();
488 return; 489 return;
489 490
490 } 491 }
491 492
492 switch( QMessageBox::information( this, "KO/Pi", 493 switch( QMessageBox::information( this, "KO/Pi",
493 i18n("Do you really want\nto close KO/Pi?"), 494 i18n("Do you really want\nto close KO/Pi?"),
494 i18n("Close"), i18n("No"), 495 i18n("Close"), i18n("No"),
495 0, 0 ) ) { 496 0, 0 ) ) {
496 case 0: 497 case 0:
497 saveOnClose(); 498 saveOnClose();
498 mClosed = true; 499 mClosed = true;
499 ce->accept(); 500 ce->accept();
500 break; 501 break;
501 case 1: 502 case 1:
502 ce->ignore(); 503 ce->ignore();
503 break; 504 break;
504 case 2: 505 case 2:
505 506
506 default: 507 default:
507 break; 508 break;
508 } 509 }
509 510
510 511
511} 512}
512 513
513void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 514void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
514{ 515{
515 QDataStream stream( data, IO_ReadOnly ); 516 QDataStream stream( data, IO_ReadOnly );
516 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 517 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
517 //QString datamess; 518 //QString datamess;
518 //qDebug("message "); 519 //qDebug("message ");
519 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 520 qDebug("KO: QCOP message received: %s ", cmsg.data() );
520 521
521 if ( cmsg == "setDocument(QString)" ) { 522 if ( cmsg == "setDocument(QString)" ) {
522 QDataStream stream( data, IO_ReadOnly ); 523 QDataStream stream( data, IO_ReadOnly );
523 QString fileName; 524 QString fileName;
524 stream >> fileName; 525 stream >> fileName;
525 //qDebug("filename %s ", fileName.latin1()); 526 //qDebug("filename %s ", fileName.latin1());
526 showMaximized(); 527 showMaximized();
527 raise(); 528 raise();
528 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 529 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
529 mSyncManager->slotSyncMenu( 1002 ); 530 mSyncManager->slotSyncMenu( 1002 );
530 return; 531 return;
531 } 532 }
532 533
533 if ( cmsg == "-writeFile" ) { 534 if ( cmsg == "-writeFile" ) {
534 // I made from the "-writeFile" an "-writeAlarm" 535 // I made from the "-writeFile" an "-writeAlarm"
535 mView->viewManager()->showWhatsNextView(); 536 mView->viewManager()->showWhatsNextView();
536 mCalendar->checkAlarmForIncidence( 0, true); 537 mCalendar->checkAlarmForIncidence( 0, true);
537 showMaximized(); 538 showMaximized();
538 raise(); 539 raise();
539 return; 540 return;
540 541
541 } 542 }
542 if ( cmsg == "-writeFileSilent" ) { 543 if ( cmsg == "-writeFileSilent" ) {
543 // I made from the "-writeFile" an "-writeAlarm" 544 // I made from the "-writeFile" an "-writeAlarm"
544 // mView->viewManager()->showWhatsNextView(); 545 // mView->viewManager()->showWhatsNextView();
545 mCalendar->checkAlarmForIncidence( 0, true); 546 mCalendar->checkAlarmForIncidence( 0, true);
546 //showMaximized(); 547 //showMaximized();
547 //raise(); 548 //raise();
548 hide(); 549 hide();
549 return; 550 return;
550 } 551 }
551 if ( cmsg == "-newCountdown" ) { 552 if ( cmsg == "-newCountdown" ) {
552 qDebug("newCountdown "); 553 qDebug("newCountdown ");
553 554
554 } 555 }
555 QString msg ; 556 QString msg ;
556 QString allmsg = cmsg; 557 QString allmsg = cmsg;
557 while ( allmsg.length() > 0 ) { 558 while ( allmsg.length() > 0 ) {
558 int nextC = allmsg.find( "-", 1 ); 559 int nextC = allmsg.find( "-", 1 );
559 if ( nextC == -1 ) { 560 if ( nextC == -1 ) {
560 msg = allmsg; 561 msg = allmsg;
561 allmsg = ""; 562 allmsg = "";
562 } else{ 563 } else{
563 msg = allmsg.left( nextC ); 564 msg = allmsg.left( nextC );
564 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 565 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
565 } 566 }
566 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 567 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
567 if ( msg == "-newEvent" ) { 568 if ( msg == "-newEvent" ) {
568 QTimer::singleShot( 0, mView, SLOT ( newEvent())); 569 QTimer::singleShot( 0, mView, SLOT ( newEvent()));
569 } 570 }
570 if ( msg == "-newTodo" ) { 571 if ( msg == "-newTodo" ) {
571 QTimer::singleShot( 0, mView, SLOT ( newTodo())); 572 QTimer::singleShot( 0, mView, SLOT ( newTodo()));
572 } 573 }
573 if ( msg == "-showWN" ) { 574 if ( msg == "-showWN" ) {
574 mView->viewManager()->showWhatsNextView(); 575 mView->viewManager()->showWhatsNextView();
575 } 576 }
576 if ( msg == "-showTodo" ) { 577 if ( msg == "-showTodo" ) {
577 mView->viewManager()->showTodoView(); 578 mView->viewManager()->showTodoView();
578 } 579 }
579 if ( msg == "-showList" ) { 580 if ( msg == "-showList" ) {
580 mView->viewManager()->showListView(); 581 mView->viewManager()->showListView();
581 } 582 }
582 else if ( msg == "-showDay" ) { 583 else if ( msg == "-showDay" ) {
583 mView->viewManager()->showDayView(); 584 mView->viewManager()->showDayView();
584 } 585 }
585 else if ( msg == "-showWWeek" ) { 586 else if ( msg == "-showWWeek" ) {
586 mView->viewManager()->showWorkWeekView(); 587 mView->viewManager()->showWorkWeekView();
587 } 588 }
588 else if ( msg == "-ringSync" ) { 589 else if ( msg == "-ringSync" ) {
589 QTimer::singleShot( 0, this, SLOT (startMultiSync())); 590 QTimer::singleShot( 0, this, SLOT (startMultiSync()));
590 } 591 }
591 else if ( msg == "-showWeek" ) { 592 else if ( msg == "-showWeek" ) {
592 mView->viewManager()->showWeekView(); 593 mView->viewManager()->showWeekView();
593 } 594 }
594 else if ( msg == "-showTodo" ) { 595 else if ( msg == "-showTodo" ) {
595 mView->viewManager()->showTodoView(); 596 mView->viewManager()->showTodoView();
596 } 597 }
597 else if ( msg == "-showJournal" ) { 598 else if ( msg == "-showJournal" ) {
598 mView->dateNavigator()->selectDates( 1 ); 599 mView->dateNavigator()->selectDates( 1 );
599 mView->dateNavigator()->selectToday(); 600 mView->dateNavigator()->selectToday();
600 mView->viewManager()->showJournalView(); 601 mView->viewManager()->showJournalView();
601 } 602 }
602 else if ( msg == "-showKO" ) { 603 else if ( msg == "-showKO" ) {
603 mView->viewManager()->showNextXView(); 604 mView->viewManager()->showNextXView();
604 } 605 }
605 else if ( msg == "-showWNext" ) { 606 else if ( msg == "-showWNext" ) {
606 mView->viewManager()->showWhatsNextView(); 607 mView->viewManager()->showWhatsNextView();
607 } 608 }
608 else if ( msg == "nextView()" ) { 609 else if ( msg == "nextView()" ) {
609 mView->viewManager()->showNextView(); 610 mView->viewManager()->showNextView();
610 } 611 }
611 else if ( msg == "-showNextXView" ) { 612 else if ( msg == "-showNextXView" ) {
612 mView->viewManager()->showNextXView(); 613 mView->viewManager()->showNextXView();
613 } 614 }
614 615
615 616
616 } 617 }
617 618
618 showMaximized(); 619 showMaximized();
619 raise(); 620 raise();
620} 621}
621void MainWindow::startMultiSync() 622void MainWindow::startMultiSync()
622{ 623{
623 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 624 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
624 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), 625 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
625 question, 626 question,
626 i18n("Yes"), i18n("No"), 627 i18n("Yes"), i18n("No"),
627 0, 0 ) != 0 ) { 628 0, 0 ) != 0 ) {
628 setCaption(i18n("Aborted! Nothing synced!")); 629 setCaption(i18n("Aborted! Nothing synced!"));
629 return; 630 return;
630 } 631 }
631 mSyncManager->multiSync( false ); 632 mSyncManager->multiSync( false );
632#ifndef DESKTOP_VERSION 633#ifndef DESKTOP_VERSION
633 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 634 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
634#endif 635#endif
635} 636}
636QPixmap MainWindow::loadPixmap( QString name ) 637QPixmap MainWindow::loadPixmap( QString name )
637{ 638{
638 return SmallIcon( name ); 639 return SmallIcon( name );
639 640
640} 641}
641void MainWindow::setUsesBigPixmaps ( bool b ) 642void MainWindow::setUsesBigPixmaps ( bool b )
642{ 643{
643 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 644 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
644 if ( b ) 645 if ( b )
645 qDebug("KO: BigPixmaps are not supported "); 646 qDebug("KO: BigPixmaps are not supported ");
646} 647}
647void MainWindow::initActions() 648void MainWindow::initActions()
648{ 649{
649 //KOPrefs::instance()->mShowFullMenu 650 //KOPrefs::instance()->mShowFullMenu
650 iconToolBar->clear(); 651 iconToolBar->clear();
651 KOPrefs *p = KOPrefs::instance(); 652 KOPrefs *p = KOPrefs::instance();
652 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 653 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
653 654
654 QPopupMenu *viewMenu = new QPopupMenu( this ); 655 QPopupMenu *viewMenu = new QPopupMenu( this );
655 QPopupMenu *actionMenu = new QPopupMenu( this ); 656 QPopupMenu *actionMenu = new QPopupMenu( this );
656 QPopupMenu *importMenu = new QPopupMenu( this ); 657 QPopupMenu *importMenu = new QPopupMenu( this );
657 QPopupMenu *importMenu_X = new QPopupMenu( this ); 658 QPopupMenu *importMenu_X = new QPopupMenu( this );
658 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 659 QPopupMenu *exportMenu_X = new QPopupMenu( this );
659 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 660 QPopupMenu *beamMenu_X = new QPopupMenu( this );
660 selectFilterMenu = new QPopupMenu( this ); 661 selectFilterMenu = new QPopupMenu( this );
661 selectFilterMenu->setCheckable( true ); 662 selectFilterMenu->setCheckable( true );
662 syncMenu = new QPopupMenu( this ); 663 syncMenu = new QPopupMenu( this );
663 configureAgendaMenu = new QPopupMenu( this ); 664 configureAgendaMenu = new QPopupMenu( this );
664 configureToolBarMenu = new QPopupMenu( this ); 665 configureToolBarMenu = new QPopupMenu( this );
665 QPopupMenu *helpMenu = new QPopupMenu( this ); 666 QPopupMenu *helpMenu = new QPopupMenu( this );
666 QIconSet icon; 667 QIconSet icon;
667 int pixWid = 22, pixHei = 22; 668 int pixWid = 22, pixHei = 22;
668 QString pathString = ""; 669 QString pathString = "";
669 if ( !p->mToolBarMiniIcons ) { 670 if ( !p->mToolBarMiniIcons ) {
670 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 671 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
671 pathString += "icons16/"; 672 pathString += "icons16/";
672 pixWid = 18; pixHei = 16; 673 pixWid = 18; pixHei = 16;
673 } 674 }
674 } else { 675 } else {
675 pathString += "iconsmini/"; 676 pathString += "iconsmini/";
676 pixWid = 18; pixHei = 16; 677 pixWid = 18; pixHei = 16;
677 } 678 }
678 if ( KOPrefs::instance()->mShowFullMenu ) { 679 if ( KOPrefs::instance()->mShowFullMenu ) {
679 QMenuBar *menuBar1; 680 QMenuBar *menuBar1;
680 menuBar1 = menuBar(); 681 menuBar1 = menuBar();
681 menuBar1->insertItem( i18n("File"), importMenu ); 682 menuBar1->insertItem( i18n("File"), importMenu );
682 menuBar1->insertItem( i18n("View"), viewMenu ); 683 menuBar1->insertItem( i18n("View"), viewMenu );
683 menuBar1->insertItem( i18n("Actions"), actionMenu ); 684 menuBar1->insertItem( i18n("Actions"), actionMenu );
684#ifdef DESKTOP_VERSION 685#ifdef DESKTOP_VERSION
685 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 686 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
686 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 687 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
687#else 688#else
688 menuBar1->insertItem( i18n("Sync"), syncMenu ); 689 menuBar1->insertItem( i18n("Sync"), syncMenu );
689 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 690 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
690#endif 691#endif
691 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 692 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
692 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 693 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
693 menuBar1->insertItem( i18n("Help"), helpMenu ); 694 menuBar1->insertItem( i18n("Help"), helpMenu );
694 } else { 695 } else {
695 QPEMenuBar *menuBar1; 696 QPEMenuBar *menuBar1;
696 menuBar1 = new QPEMenuBar( iconToolBar ); 697 menuBar1 = new QPEMenuBar( iconToolBar );
697 QPopupMenu *menuBar = new QPopupMenu( this ); 698 QPopupMenu *menuBar = new QPopupMenu( this );
698 icon = loadPixmap( pathString + "z_menu" ); 699 icon = loadPixmap( pathString + "z_menu" );
699 menuBar1->insertItem( icon.pixmap(), menuBar); 700 menuBar1->insertItem( icon.pixmap(), menuBar);
700 //menuBar1->insertItem( i18n("ME"), menuBar); 701 //menuBar1->insertItem( i18n("ME"), menuBar);
701 menuBar->insertItem( i18n("File"), importMenu ); 702 menuBar->insertItem( i18n("File"), importMenu );
702 menuBar->insertItem( i18n("View"), viewMenu ); 703 menuBar->insertItem( i18n("View"), viewMenu );
703 menuBar->insertItem( i18n("Actions"), actionMenu ); 704 menuBar->insertItem( i18n("Actions"), actionMenu );
704 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 705 menuBar->insertItem( i18n("Synchronize"), syncMenu );
705 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 706 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
706 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 707 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
707 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 708 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
708 menuBar->insertItem( i18n("Help"), helpMenu ); 709 menuBar->insertItem( i18n("Help"), helpMenu );
709 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 710 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
710 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 711 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
711 } 712 }
712 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 713 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
713 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 714 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
714 715
715 716
716 mWeekBgColor = iconToolBar->backgroundColor(); 717 mWeekBgColor = iconToolBar->backgroundColor();
717 mWeekPixmap.resize( pixWid , pixHei ); 718 mWeekPixmap.resize( pixWid , pixHei );
718 mWeekPixmap.fill( mWeekBgColor ); 719 mWeekPixmap.fill( mWeekBgColor );
719 icon = mWeekPixmap; 720 icon = mWeekPixmap;
720 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 721 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
721 if ( p-> mShowIconWeekNum ) 722 if ( p-> mShowIconWeekNum )
722 mWeekAction->addTo( iconToolBar ); 723 mWeekAction->addTo( iconToolBar );
723 mWeekFont = font(); 724 mWeekFont = font();
724 725
725 int fontPoint = mWeekFont.pointSize(); 726 int fontPoint = mWeekFont.pointSize();
726 QFontMetrics f( mWeekFont ); 727 QFontMetrics f( mWeekFont );
727 int fontWid = f.width( "30" ); 728 int fontWid = f.width( "30" );
728 while ( fontWid > pixWid ) { 729 while ( fontWid > pixWid ) {
729 --fontPoint; 730 --fontPoint;
730 mWeekFont.setPointSize( fontPoint ); 731 mWeekFont.setPointSize( fontPoint );
731 QFontMetrics f( mWeekFont ); 732 QFontMetrics f( mWeekFont );
732 fontWid = f.width( "30" ); 733 fontWid = f.width( "30" );
733 //qDebug("dec-- "); 734 //qDebug("dec-- ");
734 } 735 }
735 736
736 connect( mWeekAction, SIGNAL( activated() ), 737 connect( mWeekAction, SIGNAL( activated() ),
737 this, SLOT( weekAction() ) ); 738 this, SLOT( weekAction() ) );
738 739
739 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 740 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
740 if ( p->mShowIconFilterview ) { 741 if ( p->mShowIconFilterview ) {
741 icon = loadPixmap( pathString + "filter" ); 742 icon = loadPixmap( pathString + "filter" );
742 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 743 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
743 connect( actionFilterMenuTB, SIGNAL( activated() ), 744 connect( actionFilterMenuTB, SIGNAL( activated() ),
744 this, SLOT( fillFilterMenuTB() ) ); 745 this, SLOT( fillFilterMenuTB() ) );
745 actionFilterMenuTB->addTo( iconToolBar ); 746 actionFilterMenuTB->addTo( iconToolBar );
746 selectFilterMenuTB = new QPopupMenu( this ); 747 selectFilterMenuTB = new QPopupMenu( this );
747 selectFilterMenuTB->setCheckable( true ); 748 selectFilterMenuTB->setCheckable( true );
748 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 749 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
749 } 750 }
750 751
751 //#endif 752 //#endif
752 // ****************** 753 // ******************
753 QAction *action; 754 QAction *action;
754 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 755 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
755 configureToolBarMenu->setCheckable( true ); 756 configureToolBarMenu->setCheckable( true );
756 757
757 758
758 configureAgendaMenu->setCheckable( true ); 759 configureAgendaMenu->setCheckable( true );
759 int iii ; 760 int iii ;
760 for ( iii = 1;iii<= 10 ;++iii ){ 761 for ( iii = 1;iii<= 10 ;++iii ){
761 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 762 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
762 } 763 }
763 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 764 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
764 765
765 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 766 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
766 this, SLOT( showConfigureAgenda( ) ) ); 767 this, SLOT( showConfigureAgenda( ) ) );
767 768
768 icon = loadPixmap( pathString + "configure" ); 769 icon = loadPixmap( pathString + "configure" );
769 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 770 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
770 action->addTo( actionMenu ); 771 action->addTo( actionMenu );
771 connect( action, SIGNAL( activated() ), 772 connect( action, SIGNAL( activated() ),
772 mView, SLOT( edit_options() ) ); 773 mView, SLOT( edit_options() ) );
773 icon = loadPixmap( pathString + "configure" ); 774 icon = loadPixmap( pathString + "configure" );
774 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 775 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
775 action->addTo( actionMenu ); 776 action->addTo( actionMenu );
776 connect( action, SIGNAL( activated() ), 777 connect( action, SIGNAL( activated() ),
777 mView, SLOT( edit_global_options() ) ); 778 mView, SLOT( edit_global_options() ) );
778 actionMenu->insertSeparator(); 779 actionMenu->insertSeparator();
779 780
780 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 781 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
781 action->addTo( actionMenu ); 782 action->addTo( actionMenu );
782 connect( action, SIGNAL( activated() ), 783 connect( action, SIGNAL( activated() ),
783 mView, SLOT( undo_delete() ) ); 784 mView, SLOT( undo_delete() ) );
784 actionMenu->insertSeparator(); 785 actionMenu->insertSeparator();
785 786
786 icon = loadPixmap( pathString + "newevent" ); 787 icon = loadPixmap( pathString + "newevent" );
787 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 788 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
788 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 789 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
789 configureToolBarMenu->insertSeparator(); 790 configureToolBarMenu->insertSeparator();
790 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 791 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
791 configureToolBarMenu->insertSeparator(); 792 configureToolBarMenu->insertSeparator();
792 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 793 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
793 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 794 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
794 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 795 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
795 ne_action->addTo( actionMenu ); 796 ne_action->addTo( actionMenu );
796 connect( ne_action, SIGNAL( activated() ), 797 connect( ne_action, SIGNAL( activated() ),
797 mView, SLOT( newEvent() ) ); 798 mView, SLOT( newEvent() ) );
798 icon = loadPixmap( pathString + "newtodo" ); 799 icon = loadPixmap( pathString + "newtodo" );
799 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 800 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
800 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 801 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
801 nt_action->addTo( actionMenu ); 802 nt_action->addTo( actionMenu );
802 connect( nt_action, SIGNAL( activated() ), 803 connect( nt_action, SIGNAL( activated() ),
803 mView, SLOT( newTodo() ) ); 804 mView, SLOT( newTodo() ) );
804 805
805 icon = loadPixmap( pathString + "today" ); 806 icon = loadPixmap( pathString + "today" );
806 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 807 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
807 today_action->addTo( viewMenu ); 808 today_action->addTo( viewMenu );
808 connect( today_action, SIGNAL( activated() ), 809 connect( today_action, SIGNAL( activated() ),
809 mView, SLOT( goToday() ) ); 810 mView, SLOT( goToday() ) );
810 viewMenu->insertSeparator(); 811 viewMenu->insertSeparator();
811 812
812 // *********************** 813 // ***********************
813 if ( KOPrefs::instance()->mVerticalScreen ) { 814 if ( KOPrefs::instance()->mVerticalScreen ) {
814 icon = SmallIcon( "1updownarrow" ); 815 icon = SmallIcon( "1updownarrow" );
815 } else { 816 } else {
816 icon = SmallIcon("1leftrightarrow" ); 817 icon = SmallIcon("1leftrightarrow" );
817 } 818 }
818 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 819 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
819 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 820 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
820 FSaction->addTo( viewMenu ); 821 FSaction->addTo( viewMenu );
821 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 822 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
822 823
823 824
824 icon = loadPixmap( pathString + "filter" ); 825 icon = loadPixmap( pathString + "filter" );
825 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 826 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
826 icon = loadPixmap( pathString + "configure" ); 827 icon = loadPixmap( pathString + "configure" );
827 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 828 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
828 action->addTo( viewMenu ); 829 action->addTo( viewMenu );
829 connect( action, SIGNAL( activated() ), 830 connect( action, SIGNAL( activated() ),
830 mView, SLOT( toggleFilter() ) ); 831 mView, SLOT( toggleFilter() ) );
831 mToggleFilter = action; 832 mToggleFilter = action;
832 icon = loadPixmap( pathString + "navi" ); 833 icon = loadPixmap( pathString + "navi" );
833 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 834 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
834 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 835 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
835 action->addTo( viewMenu ); 836 action->addTo( viewMenu );
836 connect( action, SIGNAL( activated() ), 837 connect( action, SIGNAL( activated() ),
837 mView, SLOT( toggleDateNavigatorWidget() ) ); 838 mView, SLOT( toggleDateNavigatorWidget() ) );
838 mToggleNav = action ; 839 mToggleNav = action ;
839 icon = loadPixmap( pathString + "allday" ); 840 icon = loadPixmap( pathString + "allday" );
840 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 841 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
841 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 842 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
842 action->addTo( viewMenu ); 843 action->addTo( viewMenu );
843 connect( action, SIGNAL( activated() ), 844 connect( action, SIGNAL( activated() ),
844 mView, SLOT( toggleAllDaySize() ) ); 845 mView, SLOT( toggleAllDaySize() ) );
845 mToggleAllday = action; 846 mToggleAllday = action;
846 847
847 848
848 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 849 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
849 mToggleNav, SLOT( setEnabled ( bool ) ) ); 850 mToggleNav, SLOT( setEnabled ( bool ) ) );
850 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 851 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
851 // mToggleFilter, SLOT( setEnabled ( bool ) ) ); 852 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
852 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 853 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
853 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 854 mToggleAllday, SLOT( setEnabled ( bool ) ) );
854 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 855 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
855 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 856 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
856 857
857 viewMenu->insertSeparator(); 858 viewMenu->insertSeparator();
858 icon = loadPixmap( pathString + "picker" ); 859 icon = loadPixmap( pathString + "picker" );
859 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 860 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
860 action->addTo( viewMenu ); 861 action->addTo( viewMenu );
861 connect( action, SIGNAL( activated() ), 862 connect( action, SIGNAL( activated() ),
862 mView, SLOT( showDatePicker() ) ); 863 mView, SLOT( showDatePicker() ) );
863 action->addTo( iconToolBar ); 864 action->addTo( iconToolBar );
864 viewMenu->insertSeparator(); 865 viewMenu->insertSeparator();
865 866
866 if ( p-> mShowIconToggleFull ) 867 if ( p-> mShowIconToggleFull )
867 FSaction->addTo( iconToolBar ); 868 FSaction->addTo( iconToolBar );
868 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 869 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
869 870
870 //******************** 871 //********************
871 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 872 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
872 873
873 874
874 icon = loadPixmap( pathString + "whatsnext" ); 875 icon = loadPixmap( pathString + "whatsnext" );
875 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 876 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
876 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 877 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
877 whatsnext_action->addTo( viewMenu ); 878 whatsnext_action->addTo( viewMenu );
878 connect( whatsnext_action, SIGNAL( activated() ), 879 connect( whatsnext_action, SIGNAL( activated() ),
879 mView->viewManager(), SLOT( showWhatsNextView() ) ); 880 mView->viewManager(), SLOT( showWhatsNextView() ) );
880 881
881 icon = loadPixmap( pathString + "xdays" ); 882 icon = loadPixmap( pathString + "xdays" );
882 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 883 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
883 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 884 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
884 xdays_action->addTo( viewMenu ); 885 xdays_action->addTo( viewMenu );
885 connect( xdays_action, SIGNAL( activated() ), 886 connect( xdays_action, SIGNAL( activated() ),
886 mView->viewManager(), SLOT( showNextXView() ) ); 887 mView->viewManager(), SLOT( showNextXView() ) );
887 888
888 889
889 icon = loadPixmap( pathString + "journal" ); 890 icon = loadPixmap( pathString + "journal" );
890 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 891 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
891 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 892 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
892 viewjournal_action->addTo( viewMenu ); 893 viewjournal_action->addTo( viewMenu );
893 connect( viewjournal_action, SIGNAL( activated() ), 894 connect( viewjournal_action, SIGNAL( activated() ),
894 mView->viewManager(), SLOT( showJournalView() ) ); 895 mView->viewManager(), SLOT( showJournalView() ) );
895 896
896 897
897 icon = loadPixmap( pathString + "day" ); 898 icon = loadPixmap( pathString + "day" );
898 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 899 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
899 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 900 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
900 day1_action->addTo( viewMenu ); 901 day1_action->addTo( viewMenu );
901 // action->addTo( toolBar ); 902 // action->addTo( toolBar );
902 connect( day1_action, SIGNAL( activated() ), 903 connect( day1_action, SIGNAL( activated() ),
903 mView->viewManager(), SLOT( showDayView() ) ); 904 mView->viewManager(), SLOT( showDayView() ) );
904 905
905 icon = loadPixmap( pathString + "workweek" ); 906 icon = loadPixmap( pathString + "workweek" );
906 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 907 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
907 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 908 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
908 day5_action->addTo( viewMenu ); 909 day5_action->addTo( viewMenu );
909 connect( day5_action, SIGNAL( activated() ), 910 connect( day5_action, SIGNAL( activated() ),
910 mView->viewManager(), SLOT( showWorkWeekView() ) ); 911 mView->viewManager(), SLOT( showWorkWeekView() ) );
911 912
912 icon = loadPixmap( pathString + "week" ); 913 icon = loadPixmap( pathString + "week" );
913 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 914 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
914 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 915 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
915 day7_action->addTo( viewMenu ); 916 day7_action->addTo( viewMenu );
916 connect( day7_action, SIGNAL( activated() ), 917 connect( day7_action, SIGNAL( activated() ),
917 mView->viewManager(), SLOT( showWeekView() ) ); 918 mView->viewManager(), SLOT( showWeekView() ) );
918 919
919 icon = loadPixmap( pathString + "workweek2" ); 920 icon = loadPixmap( pathString + "workweek2" );
920 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 921 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
921 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 922 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
922 day6_action->addTo( viewMenu ); 923 day6_action->addTo( viewMenu );
923 connect( day6_action, SIGNAL( activated() ), 924 connect( day6_action, SIGNAL( activated() ),
924 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 925 mView->viewManager(), SLOT( showMonthViewWeek() ) );
925 926
926 icon = loadPixmap( pathString + "month" ); 927 icon = loadPixmap( pathString + "month" );
927 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 928 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
928 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 929 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
929 month_action->addTo( viewMenu ); 930 month_action->addTo( viewMenu );
930 connect( month_action, SIGNAL( activated() ), 931 connect( month_action, SIGNAL( activated() ),
931 mView->viewManager(), SLOT( showMonthView() ) ); 932 mView->viewManager(), SLOT( showMonthView() ) );
932 933
933 icon = loadPixmap( pathString + "list" ); 934 icon = loadPixmap( pathString + "list" );
934 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 935 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
935 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 936 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
936 showlist_action->addTo( viewMenu ); 937 showlist_action->addTo( viewMenu );
937 connect( showlist_action, SIGNAL( activated() ), 938 connect( showlist_action, SIGNAL( activated() ),
938 mView->viewManager(), SLOT( showListView() ) ); 939 mView->viewManager(), SLOT( showListView() ) );
939 940
940 icon = loadPixmap( pathString + "todo" ); 941 icon = loadPixmap( pathString + "todo" );
941 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 942 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
942 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 943 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
943 todoview_action->addTo( viewMenu ); 944 todoview_action->addTo( viewMenu );
944 connect( todoview_action, SIGNAL( activated() ), 945 connect( todoview_action, SIGNAL( activated() ),
945 mView->viewManager(), SLOT( showTodoView() ) ); 946 mView->viewManager(), SLOT( showTodoView() ) );
946 947
947 948
948 949
949#if 0 950#if 0
950 action = new QAction( "view_timespan", "Time Span", 0, this ); 951 action = new QAction( "view_timespan", "Time Span", 0, this );
951 action->addTo( viewMenu ); 952 action->addTo( viewMenu );
952 connect( action, SIGNAL( activated() ), 953 connect( action, SIGNAL( activated() ),
953 mView->viewManager(), SLOT( showTimeSpanView() ) ); 954 mView->viewManager(), SLOT( showTimeSpanView() ) );
954#endif 955#endif
955 956
956 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 957 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
957 this ); 958 this );
958 mNewSubTodoAction->addTo( actionMenu ); 959 mNewSubTodoAction->addTo( actionMenu );
959 connect( mNewSubTodoAction, SIGNAL( activated() ), 960 connect( mNewSubTodoAction, SIGNAL( activated() ),
960 mView, SLOT( newSubTodo() ) ); 961 mView, SLOT( newSubTodo() ) );
961 962
962 actionMenu->insertSeparator(); 963 actionMenu->insertSeparator();
963 964
964 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 965 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
965 mShowAction->addTo( actionMenu ); 966 mShowAction->addTo( actionMenu );
966 connect( mShowAction, SIGNAL( activated() ), 967 connect( mShowAction, SIGNAL( activated() ),
967 mView, SLOT( showIncidence() ) ); 968 mView, SLOT( showIncidence() ) );
968 969
969 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 970 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
970 mEditAction->addTo( actionMenu ); 971 mEditAction->addTo( actionMenu );
971 connect( mEditAction, SIGNAL( activated() ), 972 connect( mEditAction, SIGNAL( activated() ),
972 mView, SLOT( editIncidence() ) ); 973 mView, SLOT( editIncidence() ) );
973 974
974 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 975 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
975 mDeleteAction->addTo( actionMenu ); 976 mDeleteAction->addTo( actionMenu );
976 connect( mDeleteAction, SIGNAL( activated() ), 977 connect( mDeleteAction, SIGNAL( activated() ),
977 mView, SLOT( deleteIncidence() ) ); 978 mView, SLOT( deleteIncidence() ) );
978 979
979 980
980 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 981 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
981 mCloneAction->addTo( actionMenu ); 982 mCloneAction->addTo( actionMenu );
982 connect( mCloneAction, SIGNAL( activated() ), 983 connect( mCloneAction, SIGNAL( activated() ),
983 mView, SLOT( cloneIncidence() ) ); 984 mView, SLOT( cloneIncidence() ) );
984 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 985 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
985 mMoveAction->addTo( actionMenu ); 986 mMoveAction->addTo( actionMenu );
986 connect( mMoveAction, SIGNAL( activated() ), 987 connect( mMoveAction, SIGNAL( activated() ),
987 mView, SLOT( moveIncidence() ) ); 988 mView, SLOT( moveIncidence() ) );
988 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 989 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
989 mBeamAction->addTo( actionMenu ); 990 mBeamAction->addTo( actionMenu );
990 connect( mBeamAction, SIGNAL( activated() ), 991 connect( mBeamAction, SIGNAL( activated() ),
991 mView, SLOT( beamIncidence() ) ); 992 mView, SLOT( beamIncidence() ) );
992 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 993 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
993 mCancelAction->addTo( actionMenu ); 994 mCancelAction->addTo( actionMenu );
994 connect( mCancelAction, SIGNAL( activated() ), 995 connect( mCancelAction, SIGNAL( activated() ),
995 mView, SLOT( toggleCancelIncidence() ) ); 996 mView, SLOT( toggleCancelIncidence() ) );
996 997
997 actionMenu->insertSeparator(); 998 actionMenu->insertSeparator();
998 999
999 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 1000 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
1000 this ); 1001 this );
1001 action->addTo( actionMenu ); 1002 action->addTo( actionMenu );
1002 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 1003 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
1003 1004
1004 icon = loadPixmap( pathString + "search" ); 1005 icon = loadPixmap( pathString + "search" );
1005 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 1006 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
1006 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 1007 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
1007 search_action->addTo( actionMenu ); 1008 search_action->addTo( actionMenu );
1008 connect( search_action, SIGNAL( activated() ), 1009 connect( search_action, SIGNAL( activated() ),
1009 mView->dialogManager(), SLOT( showSearchDialog() ) ); 1010 mView->dialogManager(), SLOT( showSearchDialog() ) );
1010 1011
1011 1012
1012 1013
1013 if ( KOPrefs::instance()->mShowFullMenu ) { 1014 if ( KOPrefs::instance()->mShowFullMenu ) {
1014 actionMenu->insertSeparator(); 1015 actionMenu->insertSeparator();
1015 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 1016 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
1016 1017
1017 } 1018 }
1018 // actionMenu->insertSeparator(); 1019 // actionMenu->insertSeparator();
1019 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 1020 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
1020 this ); 1021 this );
1021 action->addTo( importMenu_X ); 1022 action->addTo( importMenu_X );
1022 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 1023 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
1023 action = new QAction( "import_quick", i18n("Import last file"), 0, 1024 action = new QAction( "import_quick", i18n("Import last file"), 0,
1024 this ); 1025 this );
1025 action->addTo( importMenu_X ); 1026 action->addTo( importMenu_X );
1026 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 1027 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
1027 importMenu_X->insertSeparator(); 1028 importMenu_X->insertSeparator();
1028 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 1029 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
1029 this ); 1030 this );
1030 action->addTo( importMenu_X ); 1031 action->addTo( importMenu_X );
1031 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 1032 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
1032 //#ifndef DESKTOP_VERSION 1033 //#ifndef DESKTOP_VERSION
1033 importMenu_X->insertSeparator(); 1034 importMenu_X->insertSeparator();
1034 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 1035 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
1035 this ); 1036 this );
1036 action->addTo( importMenu_X ); 1037 action->addTo( importMenu_X );
1037 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 1038 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
1038 //#else 1039 //#else
1039#ifdef _OL_IMPORT_ 1040#ifdef _OL_IMPORT_
1040 importMenu_X->insertSeparator(); 1041 importMenu_X->insertSeparator();
1041 action = new QAction( "import_ol", i18n("Import from OL"), 0, 1042 action = new QAction( "import_ol", i18n("Import from OL"), 0,
1042 this ); 1043 this );
1043 action->addTo( importMenu_X ); 1044 action->addTo( importMenu_X );
1044 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1045 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1045#endif 1046#endif
1046 //#endif 1047 //#endif
1047 1048
1048 //importMenu->insertSeparator(); 1049 //importMenu->insertSeparator();
1049#if 0 1050#if 0
1050 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1051 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
1051 this ); 1052 this );
1052 action->addTo( importMenu ); 1053 action->addTo( importMenu );
1053 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1054 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1054#endif 1055#endif
1055 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 1056 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
1056 this ); 1057 this );
1057 action->addTo( importMenu ); 1058 action->addTo( importMenu );
1058 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1059 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1059 importMenu->insertSeparator(); 1060 importMenu->insertSeparator();
1060 importMenu->insertItem( i18n("Import"), importMenu_X ); 1061 importMenu->insertItem( i18n("Import"), importMenu_X );
1061 //importMenu->insertSeparator(); 1062 //importMenu->insertSeparator();
1062 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 1063 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
1063 this ); 1064 this );
1064 action->addTo( exportMenu_X ); 1065 action->addTo( exportMenu_X );
1065 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1066 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1066 1067
1067 1068
1068 //LR 1069 //LR
1069 QPopupMenu *ex2phone = new QPopupMenu( this ); 1070 QPopupMenu *ex2phone = new QPopupMenu( this );
1070 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1071 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1071 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1072 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1072 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1073 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1073 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1074 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1074 1075
1075 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1076 importMenu->insertItem( i18n("Export"), exportMenu_X );
1076#ifndef DESKTOP_VERSION 1077#ifndef DESKTOP_VERSION
1077 //importMenu->insertSeparator(); 1078 //importMenu->insertSeparator();
1078 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1079 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1079 this ); 1080 this );
1080 brAction->addTo( beamMenu_X ); 1081 brAction->addTo( beamMenu_X );
1081 brAction->setToggleAction (true ) ; 1082 brAction->setToggleAction (true ) ;
1082 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1083 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1083 1084
1084 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1085 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1085 this ); 1086 this );
1086 action->addTo( beamMenu_X ); 1087 action->addTo( beamMenu_X );
1087 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1088 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1088 1089
1089 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1090 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1090 this ); 1091 this );
1091 action->addTo( beamMenu_X ); 1092 action->addTo( beamMenu_X );
1092 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1093 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1093 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1094 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1094#else 1095#else
1095 //importMenu->insertSeparator(); 1096 //importMenu->insertSeparator();
1096 icon = loadPixmap( pathString + "print" ); 1097 icon = loadPixmap( pathString + "print" );
1097 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1098 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1098 action->addTo( beamMenu_X ); 1099 action->addTo( beamMenu_X );
1099 connect( action, SIGNAL( activated() ), 1100 connect( action, SIGNAL( activated() ),
1100 this, SLOT( printCal() ) ); 1101 this, SLOT( printCal() ) );
1101 1102
1102 icon = loadPixmap( pathString + "print" ); 1103 icon = loadPixmap( pathString + "print" );
1103 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1104 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1104 action->addTo( beamMenu_X ); 1105 action->addTo( beamMenu_X );
1105 connect( action, SIGNAL( activated() ), 1106 connect( action, SIGNAL( activated() ),
1106 this, SLOT( printSel() ) ); 1107 this, SLOT( printSel() ) );
1107 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1108 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1108 action->addTo( beamMenu_X ); 1109 action->addTo( beamMenu_X );
1109 connect( action, SIGNAL( activated() ), 1110 connect( action, SIGNAL( activated() ),
1110 mView->viewManager(), SLOT( slotprintWNV() ) ); 1111 mView->viewManager(), SLOT( slotprintWNV() ) );
1111 1112
1112 1113
1113 icon = loadPixmap( pathString + "print" ); 1114 icon = loadPixmap( pathString + "print" );
1114 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); 1115 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this );
1115 action->addTo( beamMenu_X ); 1116 action->addTo( beamMenu_X );
1116 connect( action, SIGNAL( activated() ), 1117 connect( action, SIGNAL( activated() ),
1117 this, SLOT( printListView() ) ); 1118 this, SLOT( printListView() ) );
1118 1119
1119 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1120 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1120 action->addTo( beamMenu_X ); 1121 action->addTo( beamMenu_X );
1121 connect( action, SIGNAL( activated() ), 1122 connect( action, SIGNAL( activated() ),
1122 mView, SLOT( slotprintSelInc() ) ); 1123 mView, SLOT( slotprintSelInc() ) );
1123 1124
1124 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1125 importMenu->insertItem( i18n("Print"), beamMenu_X );
1125#endif 1126#endif
1126 importMenu->insertSeparator(); 1127 importMenu->insertSeparator();
1127 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1128 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1128 this ); 1129 this );
1129 action->addTo( importMenu ); 1130 action->addTo( importMenu );
1130 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1131 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1131 importMenu->insertSeparator(); 1132 importMenu->insertSeparator();
1132 action = new QAction( "beam all", i18n("Save"), 0, 1133 action = new QAction( "beam all", i18n("Save"), 0,
1133 this ); 1134 this );
1134 action->addTo( importMenu ); 1135 action->addTo( importMenu );
1135 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1136 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1136 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1137 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1137 this ); 1138 this );
1138 action->addTo( importMenu ); 1139 action->addTo( importMenu );
1139 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1140 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1140 1141
1141 //menuBar->insertItem( "Configure",configureMenu ); 1142 //menuBar->insertItem( "Configure",configureMenu );
1142 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1143 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1143 icon = loadPixmap( "korganizer/korganizer" ); 1144 icon = loadPixmap( "korganizer/korganizer" );
1144 1145
1145 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1146 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1146 action->addTo( helpMenu ); 1147 action->addTo( helpMenu );
1147 connect( action, SIGNAL( activated() ), 1148 connect( action, SIGNAL( activated() ),
1148 SLOT( whatsNew() ) ); 1149 SLOT( whatsNew() ) );
1149 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1150 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1150 action->addTo( helpMenu ); 1151 action->addTo( helpMenu );
1151 connect( action, SIGNAL( activated() ), 1152 connect( action, SIGNAL( activated() ),
1152 SLOT( features() ) ); 1153 SLOT( features() ) );
1153 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1154 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1154 action->addTo( helpMenu ); 1155 action->addTo( helpMenu );
1155 connect( action, SIGNAL( activated() ), 1156 connect( action, SIGNAL( activated() ),
1156 SLOT( keyBindings() ) ); 1157 SLOT( keyBindings() ) );
1157 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1158 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1158 action->addTo( helpMenu ); 1159 action->addTo( helpMenu );
1159 connect( action, SIGNAL( activated() ), 1160 connect( action, SIGNAL( activated() ),
1160 SLOT( storagehowto() ) ); 1161 SLOT( storagehowto() ) );
1161 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1162 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1162 action->addTo( helpMenu ); 1163 action->addTo( helpMenu );
1163 connect( action, SIGNAL( activated() ), 1164 connect( action, SIGNAL( activated() ),
1164 SLOT( timetrackinghowto() ) ); 1165 SLOT( timetrackinghowto() ) );
1165 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1166 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1166 action->addTo( helpMenu ); 1167 action->addTo( helpMenu );
1167 connect( action, SIGNAL( activated() ), 1168 connect( action, SIGNAL( activated() ),
1168 SLOT( synchowto() ) ); 1169 SLOT( synchowto() ) );
1169 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1170 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1170 action->addTo( helpMenu ); 1171 action->addTo( helpMenu );
1171 connect( action, SIGNAL( activated() ), 1172 connect( action, SIGNAL( activated() ),
1172 SLOT( kdesynchowto() ) ); 1173 SLOT( kdesynchowto() ) );
1173 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1174 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1174 action->addTo( helpMenu ); 1175 action->addTo( helpMenu );
1175 connect( action, SIGNAL( activated() ), 1176 connect( action, SIGNAL( activated() ),
1176 SLOT( multisynchowto() ) ); 1177 SLOT( multisynchowto() ) );
1177 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1178 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1178 action->addTo( helpMenu ); 1179 action->addTo( helpMenu );
1179 connect( action, SIGNAL( activated() ), 1180 connect( action, SIGNAL( activated() ),
1180 SLOT( aboutAutoSaving() ) ); 1181 SLOT( aboutAutoSaving() ) );
1181 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1182 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1182 action->addTo( helpMenu ); 1183 action->addTo( helpMenu );
1183 connect( action, SIGNAL( activated() ), 1184 connect( action, SIGNAL( activated() ),
1184 SLOT( aboutKnownBugs() ) ); 1185 SLOT( aboutKnownBugs() ) );
1185 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1186 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1186 action->addTo( helpMenu ); 1187 action->addTo( helpMenu );
1187 connect( action, SIGNAL( activated() ), 1188 connect( action, SIGNAL( activated() ),
1188 SLOT( usertrans() ) ); 1189 SLOT( usertrans() ) );
1189 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1190 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1190 action->addTo( helpMenu ); 1191 action->addTo( helpMenu );
1191 connect( action, SIGNAL( activated() ), 1192 connect( action, SIGNAL( activated() ),
1192 SLOT( faq() ) ); 1193 SLOT( faq() ) );
1193 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1194 action = new QAction( "licence", i18n("Licence..."), 0, this );
1194 action->addTo( helpMenu ); 1195 action->addTo( helpMenu );
1195 connect( action, SIGNAL( activated() ), 1196 connect( action, SIGNAL( activated() ),
1196 SLOT( licence() ) ); 1197 SLOT( licence() ) );
1197 action = new QAction( "about", i18n("About..."), 0, this ); 1198 action = new QAction( "about", i18n("About..."), 0, this );
1198 action->addTo( helpMenu ); 1199 action->addTo( helpMenu );
1199 connect( action, SIGNAL( activated() ), 1200 connect( action, SIGNAL( activated() ),
1200 SLOT( about() ) ); 1201 SLOT( about() ) );
1201 //menuBar->insertSeparator(); 1202 //menuBar->insertSeparator();
1202 1203
1203 // ****************************************************** 1204 // ******************************************************
1204 // menubar icons 1205 // menubar icons
1205 1206
1206 1207
1207 1208
1208 //menuBar->insertItem( iconToolBar ); 1209 //menuBar->insertItem( iconToolBar );
1209 //xdays_action 1210 //xdays_action
1210 if (p-> mShowIconNewEvent) 1211 if (p-> mShowIconNewEvent)
1211 ne_action->addTo( iconToolBar ); 1212 ne_action->addTo( iconToolBar );
1212 if (p->mShowIconNewTodo ) 1213 if (p->mShowIconNewTodo )
1213 nt_action->addTo( iconToolBar ); 1214 nt_action->addTo( iconToolBar );
1214 if (p-> mShowIconSearch) 1215 if (p-> mShowIconSearch)
1215 search_action->addTo( iconToolBar ); 1216 search_action->addTo( iconToolBar );
1216 if (p-> mShowIconWhatsThis) 1217 if (p-> mShowIconWhatsThis)
1217 QWhatsThis::whatsThisButton ( iconToolBar ); 1218 QWhatsThis::whatsThisButton ( iconToolBar );
1218 if (p-> mShowIconNext) 1219 if (p-> mShowIconNext)
1219 whatsnext_action->addTo( viewToolBar ); 1220 whatsnext_action->addTo( viewToolBar );
1220 if (p-> mShowIconNextDays) 1221 if (p-> mShowIconNextDays)
1221 xdays_action->addTo( viewToolBar ); 1222 xdays_action->addTo( viewToolBar );
1222 if (p-> mShowIconJournal) 1223 if (p-> mShowIconJournal)
1223 viewjournal_action->addTo( viewToolBar ); 1224 viewjournal_action->addTo( viewToolBar );
1224 if (p-> mShowIconDay1) 1225 if (p-> mShowIconDay1)
1225 day1_action->addTo( viewToolBar ); 1226 day1_action->addTo( viewToolBar );
1226 if (p-> mShowIconDay5) 1227 if (p-> mShowIconDay5)
1227 day5_action->addTo( viewToolBar ); 1228 day5_action->addTo( viewToolBar );
1228 if (p-> mShowIconDay7) 1229 if (p-> mShowIconDay7)
1229 day7_action->addTo( viewToolBar ); 1230 day7_action->addTo( viewToolBar );
1230 if (p-> mShowIconDay6) 1231 if (p-> mShowIconDay6)
1231 day6_action->addTo( viewToolBar ); 1232 day6_action->addTo( viewToolBar );
1232 if (p-> mShowIconMonth) 1233 if (p-> mShowIconMonth)
1233 month_action->addTo( viewToolBar ); 1234 month_action->addTo( viewToolBar );
1234 if (p-> mShowIconList) 1235 if (p-> mShowIconList)
1235 showlist_action->addTo( viewToolBar ); 1236 showlist_action->addTo( viewToolBar );
1236 if (p-> mShowIconTodoview) 1237 if (p-> mShowIconTodoview)
1237 todoview_action->addTo( viewToolBar ); 1238 todoview_action->addTo( viewToolBar );
1238 1239
1239 icon = loadPixmap( pathString + "2leftarrowB" ); 1240 icon = loadPixmap( pathString + "2leftarrowB" );
1240 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1241 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1241 if (p-> mShowIconBackFast) { 1242 if (p-> mShowIconBackFast) {
1242 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1243 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1243 connect( action, SIGNAL( activated() ), 1244 connect( action, SIGNAL( activated() ),
1244 mView, SLOT( goPreviousMonth() ) ); 1245 mView, SLOT( goPreviousMonth() ) );
1245 action->addTo( navigatorToolBar ); 1246 action->addTo( navigatorToolBar );
1246 } 1247 }
1247 icon = loadPixmap( pathString + "1leftarrowB" ); 1248 icon = loadPixmap( pathString + "1leftarrowB" );
1248 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1249 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1249 if (p-> mShowIconBack) { 1250 if (p-> mShowIconBack) {
1250 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1251 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1251 connect( action, SIGNAL( activated() ), 1252 connect( action, SIGNAL( activated() ),
1252 mView, SLOT( goPrevious() ) ); 1253 mView, SLOT( goPrevious() ) );
1253 action->addTo( navigatorToolBar ); 1254 action->addTo( navigatorToolBar );
1254 } 1255 }
1255 icon = loadPixmap( pathString + "today" ); 1256 icon = loadPixmap( pathString + "today" );
1256 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1257 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1257 if (p-> mShowIconToday) 1258 if (p-> mShowIconToday)
1258 today_action->addTo( navigatorToolBar ); 1259 today_action->addTo( navigatorToolBar );
1259 icon = loadPixmap( pathString + "1rightarrowB" ); 1260 icon = loadPixmap( pathString + "1rightarrowB" );
1260 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1261 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1261 if (p-> mShowIconForward) { 1262 if (p-> mShowIconForward) {
1262 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1263 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1263 connect( action, SIGNAL( activated() ), 1264 connect( action, SIGNAL( activated() ),
1264 mView, SLOT( goNext() ) ); 1265 mView, SLOT( goNext() ) );
1265 action->addTo( navigatorToolBar ); 1266 action->addTo( navigatorToolBar );
1266 } 1267 }
1267 icon = loadPixmap( pathString + "2rightarrowB" ); 1268 icon = loadPixmap( pathString + "2rightarrowB" );
1268 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1269 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1269 if (p-> mShowIconForwardFast) { 1270 if (p-> mShowIconForwardFast) {
1270 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1271 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1271 connect( action, SIGNAL( activated() ), 1272 connect( action, SIGNAL( activated() ),
1272 mView, SLOT( goNextMonth() ) ); 1273 mView, SLOT( goNextMonth() ) );
1273 action->addTo( navigatorToolBar ); 1274 action->addTo( navigatorToolBar );
1274 } 1275 }
1275 1276
1276 1277
1277 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1278 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1278 1279
1279 1280
1280 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1281 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1281 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1282 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1282 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1283 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1283 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1284 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1284 1285
1285 if (p-> mShowIconNewEvent) 1286 if (p-> mShowIconNewEvent)
1286 configureToolBarMenu->setItemChecked( 10, true ); 1287 configureToolBarMenu->setItemChecked( 10, true );
1287 if (p->mShowIconNewTodo ) 1288 if (p->mShowIconNewTodo )
1288 configureToolBarMenu->setItemChecked( 20, true ); 1289 configureToolBarMenu->setItemChecked( 20, true );
1289 if (p-> mShowIconSearch) 1290 if (p-> mShowIconSearch)
1290 configureToolBarMenu->setItemChecked( 120, true ); 1291 configureToolBarMenu->setItemChecked( 120, true );
1291 if (p-> mShowIconList) 1292 if (p-> mShowIconList)
1292 configureToolBarMenu->setItemChecked( 30, true ); 1293 configureToolBarMenu->setItemChecked( 30, true );
1293 if (p-> mShowIconDay1) 1294 if (p-> mShowIconDay1)
1294 configureToolBarMenu->setItemChecked( 40, true ); 1295 configureToolBarMenu->setItemChecked( 40, true );
1295 if (p-> mShowIconDay5) 1296 if (p-> mShowIconDay5)
1296 configureToolBarMenu->setItemChecked( 50, true ); 1297 configureToolBarMenu->setItemChecked( 50, true );
1297 if (p-> mShowIconDay6) 1298 if (p-> mShowIconDay6)
1298 configureToolBarMenu->setItemChecked( 75, true ); 1299 configureToolBarMenu->setItemChecked( 75, true );
1299 if (p-> mShowIconDay7) 1300 if (p-> mShowIconDay7)
1300 configureToolBarMenu->setItemChecked( 60, true ); 1301 configureToolBarMenu->setItemChecked( 60, true );
1301 if (p-> mShowIconMonth) 1302 if (p-> mShowIconMonth)
1302 configureToolBarMenu->setItemChecked( 70, true ); 1303 configureToolBarMenu->setItemChecked( 70, true );
1303 if (p-> mShowIconTodoview) 1304 if (p-> mShowIconTodoview)
1304 configureToolBarMenu->setItemChecked( 80, true ); 1305 configureToolBarMenu->setItemChecked( 80, true );
1305 if (p-> mShowIconBackFast) 1306 if (p-> mShowIconBackFast)
1306 configureToolBarMenu->setItemChecked( 200, true ); 1307 configureToolBarMenu->setItemChecked( 200, true );
1307 if (p-> mShowIconBack) 1308 if (p-> mShowIconBack)
1308 configureToolBarMenu->setItemChecked( 210, true ); 1309 configureToolBarMenu->setItemChecked( 210, true );
1309 if (p-> mShowIconToday) 1310 if (p-> mShowIconToday)
1310 configureToolBarMenu->setItemChecked( 130, true ); 1311 configureToolBarMenu->setItemChecked( 130, true );
1311 if (p-> mShowIconForward) 1312 if (p-> mShowIconForward)
1312 configureToolBarMenu->setItemChecked( 220, true ); 1313 configureToolBarMenu->setItemChecked( 220, true );
1313 if (p-> mShowIconForwardFast) 1314 if (p-> mShowIconForwardFast)
1314 configureToolBarMenu->setItemChecked( 230, true ); 1315 configureToolBarMenu->setItemChecked( 230, true );
1315 if (p-> mShowIconNextDays) 1316 if (p-> mShowIconNextDays)
1316 configureToolBarMenu->setItemChecked( 100, true ); 1317 configureToolBarMenu->setItemChecked( 100, true );
1317 if (p-> mShowIconNext) 1318 if (p-> mShowIconNext)
1318 configureToolBarMenu->setItemChecked( 110, true ); 1319 configureToolBarMenu->setItemChecked( 110, true );
1319 if (p-> mShowIconJournal) 1320 if (p-> mShowIconJournal)
1320 configureToolBarMenu->setItemChecked( 90, true ); 1321 configureToolBarMenu->setItemChecked( 90, true );
1321 if (p-> mShowIconWhatsThis) 1322 if (p-> mShowIconWhatsThis)
1322 configureToolBarMenu->setItemChecked( 300, true ); 1323 configureToolBarMenu->setItemChecked( 300, true );
1323 if (p-> mShowIconWeekNum) 1324 if (p-> mShowIconWeekNum)
1324 configureToolBarMenu->setItemChecked( 400, true ); 1325 configureToolBarMenu->setItemChecked( 400, true );
1325 if (!p-> mShowIconStretch) { 1326 if (!p-> mShowIconStretch) {
1326 QLabel* dummy = new QLabel( iconToolBar ); 1327 QLabel* dummy = new QLabel( iconToolBar );
1327 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1328 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1328 dummy->setMinimumWidth( 0 ); 1329 dummy->setMinimumWidth( 0 );
1329 iconToolBar->setStretchableWidget ( dummy ) ; 1330 iconToolBar->setStretchableWidget ( dummy ) ;
1330 } 1331 }
1331 else { 1332 else {
1332 iconToolBar->setHorizontalStretchable (true ); 1333 iconToolBar->setHorizontalStretchable (true );
1333 viewToolBar->setHorizontalStretchable (true ); 1334 viewToolBar->setHorizontalStretchable (true );
1334 navigatorToolBar->setHorizontalStretchable (true ); 1335 navigatorToolBar->setHorizontalStretchable (true );
1335 iconToolBar->setVerticalStretchable (true ); 1336 iconToolBar->setVerticalStretchable (true );
1336 viewToolBar->setVerticalStretchable (true ); 1337 viewToolBar->setVerticalStretchable (true );
1337 navigatorToolBar->setVerticalStretchable (true ); 1338 navigatorToolBar->setVerticalStretchable (true );
1338 configureToolBarMenu->setItemChecked( 5, true ); 1339 configureToolBarMenu->setItemChecked( 5, true );
1339 } 1340 }
1340 if (p-> mShowIconFilter) 1341 if (p-> mShowIconFilter)
1341 configureToolBarMenu->setItemChecked( 7, true ); 1342 configureToolBarMenu->setItemChecked( 7, true );
1342 if (p-> mShowIconOnetoolbar) 1343 if (p-> mShowIconOnetoolbar)
1343 configureToolBarMenu->setItemChecked( 6, true ); 1344 configureToolBarMenu->setItemChecked( 6, true );
1344 1345
1345 1346
1346 if ( filterMenubar ) { 1347 if ( filterMenubar ) {
1347 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1348 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1348 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); 1349 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) );
1349 } 1350 }
1350 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1351 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1351 configureAgenda( p->mHourSize ); 1352 configureAgenda( p->mHourSize );
1352 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1353 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1353} 1354}
1354 1355
1355void MainWindow::exportToPhone( int mode ) 1356void MainWindow::exportToPhone( int mode )
1356{ 1357{
1357 1358
1358 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1359 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1359 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1360 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1360 KOex2phonePrefs ex2phone; 1361 KOex2phonePrefs ex2phone;
1361 1362
1362 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1363 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1363 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1364 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1364 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1365 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1365 if ( mode == 1 ) 1366 if ( mode == 1 )
1366 ex2phone.setCaption(i18n("Export complete calendar")); 1367 ex2phone.setCaption(i18n("Export complete calendar"));
1367 if ( mode == 2 ) 1368 if ( mode == 2 )
1368 ex2phone.setCaption(i18n("Export filtered calendar")); 1369 ex2phone.setCaption(i18n("Export filtered calendar"));
1369 1370
1370 if ( !ex2phone.exec() ) { 1371 if ( !ex2phone.exec() ) {
1371 return; 1372 return;
1372 } 1373 }
1373 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1374 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1374 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1375 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1375 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1376 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1376 1377
1377 int inFuture = 0; 1378 int inFuture = 0;
1378 if ( ex2phone.mWriteBackFuture->isChecked() ) 1379 if ( ex2phone.mWriteBackFuture->isChecked() )
1379 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1380 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1380 QPtrList<Incidence> delSel; 1381 QPtrList<Incidence> delSel;
1381 if ( mode == 1 ) 1382 if ( mode == 1 )
1382 delSel = mCalendar->rawIncidences(); 1383 delSel = mCalendar->rawIncidences();
1383 if ( mode == 2 ) 1384 if ( mode == 2 )
1384 delSel = mCalendar->incidences(); 1385 delSel = mCalendar->incidences();
1385 CalendarLocal* cal = new CalendarLocal(); 1386 CalendarLocal* cal = new CalendarLocal();
1386 cal->setLocalTime(); 1387 cal->setLocalTime();
1387 Incidence *incidence = delSel.first(); 1388 Incidence *incidence = delSel.first();
1388 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1389 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1389 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1390 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1390 while ( incidence ) { 1391 while ( incidence ) {
1391 if ( incidence->typeID() != journalID ) { 1392 if ( incidence->typeID() != journalID ) {
1392 bool add = true; 1393 bool add = true;
1393 if ( inFuture ) { 1394 if ( inFuture ) {
1394 QDateTime dt; 1395 QDateTime dt;
1395 if ( incidence->typeID() == todoID ) { 1396 if ( incidence->typeID() == todoID ) {
1396 Todo * t = (Todo*)incidence; 1397 Todo * t = (Todo*)incidence;
1397 if ( t->hasDueDate() ) 1398 if ( t->hasDueDate() )
1398 dt = t->dtDue(); 1399 dt = t->dtDue();
1399 else 1400 else
1400 dt = cur.addSecs( 62 ); 1401 dt = cur.addSecs( 62 );
1401 } 1402 }
1402 else { 1403 else {
1403 bool ok; 1404 bool ok;
1404 dt = incidence->getNextOccurence( cur, &ok ); 1405 dt = incidence->getNextOccurence( cur, &ok );
1405 if ( !ok ) 1406 if ( !ok )
1406 dt = cur.addSecs( -62 ); 1407 dt = cur.addSecs( -62 );
1407 } 1408 }
1408 if ( dt < cur || dt > end ) { 1409 if ( dt < cur || dt > end ) {
1409 add = false; 1410 add = false;
1410 } 1411 }
1411 } 1412 }
1412 if ( add ) { 1413 if ( add ) {
1413 Incidence *in = incidence->clone(); 1414 Incidence *in = incidence->clone();
1414 cal->addIncidence( in ); 1415 cal->addIncidence( in );
1415 } 1416 }
1416 } 1417 }
1417 incidence = delSel.next(); 1418 incidence = delSel.next();
1418 } 1419 }
1419 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1420 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1420 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1421 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1421 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1422 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1422 1423
1423 setCaption( i18n("Writing to phone...")); 1424 setCaption( i18n("Writing to phone..."));
1424 if ( PhoneFormat::writeToPhone( cal ) ) 1425 if ( PhoneFormat::writeToPhone( cal ) )
1425 setCaption( i18n("Export to phone successful!")); 1426 setCaption( i18n("Export to phone successful!"));
1426 else 1427 else
1427 setCaption( i18n("Error exporting to phone!")); 1428 setCaption( i18n("Error exporting to phone!"));
1428 delete cal; 1429 delete cal;
1429} 1430}
1430 1431
1431 1432
1432void MainWindow::setDefaultPreferences() 1433void MainWindow::setDefaultPreferences()
1433{ 1434{
1434 KOPrefs *p = KOPrefs::instance(); 1435 KOPrefs *p = KOPrefs::instance();
1435 1436
1436 p->mCompactDialogs = true; 1437 p->mCompactDialogs = true;
1437 p->mConfirm = true; 1438 p->mConfirm = true;
1438 // p->mEnableQuickTodo = false; 1439 // p->mEnableQuickTodo = false;
1439 1440
1440} 1441}
1441 1442
1442QString MainWindow::resourcePath() 1443QString MainWindow::resourcePath()
1443{ 1444{
1444 return KGlobal::iconLoader()->iconPath(); 1445 return KGlobal::iconLoader()->iconPath();
1445} 1446}
1446 1447
1447void MainWindow::displayText( QString text ,QString cap ) 1448void MainWindow::displayText( QString text ,QString cap )
1448{ 1449{
1449 QDialog dia( this, "name", true ); ; 1450 QDialog dia( this, "name", true ); ;
1450 dia.setCaption( cap ); 1451 dia.setCaption( cap );
1451 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1452 QVBoxLayout* lay = new QVBoxLayout( &dia );
1452 lay->setSpacing( 3 ); 1453 lay->setSpacing( 3 );
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
1465void MainWindow::features() 1466void 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
1471void MainWindow::usertrans() 1472void 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
1477void MainWindow::storagehowto() 1478void 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}
1481void MainWindow::timetrackinghowto() 1482void 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}
1485void MainWindow::kdesynchowto() 1486void 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}
1489void MainWindow::multisynchowto() 1490void 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}
1493void MainWindow::synchowto() 1494void 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}
1497void MainWindow::faq() 1498void 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}
1502void MainWindow::whatsNew() 1503void 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}
1507void MainWindow::licence() 1508void MainWindow::licence()
1508{ 1509{
1509 KApplication::showLicence(); 1510 KApplication::showLicence();
1510 1511
1511} 1512}
1512void MainWindow::about() 1513void 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}
1527void MainWindow::keyBindings() 1528void 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}
1586void MainWindow::aboutAutoSaving() 1587void 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}
1593void MainWindow::aboutKnownBugs() 1594void 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
1611QString MainWindow::defaultFileName() 1612QString MainWindow::defaultFileName()
1612{ 1613{
1613 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1614 return locateLocal( "data", "korganizer/mycalendar.ics" );
1614} 1615}
1615QString MainWindow::syncFileName() 1616QString 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>
1625void MainWindow::updateWeek(QDate seda) 1626void 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}
1637void MainWindow::updateWeekNum(const DateList &selectedDates) 1638void MainWindow::updateWeekNum(const DateList &selectedDates)
1638{ 1639{
1639 updateWeek( selectedDates.first() ); 1640 updateWeek( selectedDates.first() );
1640} 1641}
1641void MainWindow::processIncidenceSelection( Incidence *incidence ) 1642void 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
1714void MainWindow::enableIncidenceActions( bool enabled ) 1715void 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
1726void MainWindow::importOL() 1727void 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}
1737void MainWindow::importBday() 1738void 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}
1750void MainWindow::importQtopia() 1751void 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
1782void MainWindow::saveOnClose() 1783void 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}
1842void MainWindow::slotModifiedChanged( bool changed ) 1844void 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}
1858void MainWindow::saveStopTimer() 1860void MainWindow::saveStopTimer()
1859{ 1861{
1860 mSaveTimer.stop(); 1862 mSaveTimer.stop();
1861} 1863}
1862void MainWindow::backupAllFiles() 1864void 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}
1900void MainWindow::save() 1902void 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
1933void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1937void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1934{ 1938{
1935 if ( !e->isAutoRepeat() ) { 1939 if ( !e->isAutoRepeat() ) {
1936 mFlagKeyPressed = false; 1940 mFlagKeyPressed = false;
1937 } 1941 }
1938} 1942}
1939void MainWindow::keyPressEvent ( QKeyEvent * e ) 1943void 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}
2118void MainWindow::fillFilterMenuTB() 2122void 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}
2163void MainWindow::fillFilterMenu() 2167void 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}
2186void MainWindow::fillFilterMenuPopup() 2190void 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}
2207void MainWindow::selectFilter( int fil ) 2211void 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}
2224void MainWindow::updateFilterToolbar() 2228void 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}
2237void MainWindow::selectFilterPopup( int fil ) 2241void MainWindow::selectFilterPopup( int fil )
2238{ 2242{
2239 selectFilter( fil + 1 ); 2243 selectFilter( fil + 1 );
2240 2244
2241} 2245}
2242void MainWindow::configureToolBar( int item ) 2246void 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}
2276void MainWindow::setCaption ( const QString & c ) 2280void 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}
2285void MainWindow::setCaptionToDates() 2289void MainWindow::setCaptionToDates()
2286{ 2290{
2287 QString selDates; 2291 QString selDates;
2288 QDate date = mView->startDate(); 2292 QDate date = mView->startDate();
2289 if ( ! date.isValid() ) { 2293 if ( ! date.isValid() ) {
2290 setCaption(""); 2294 setCaption("");
2291 return; 2295 return;
2292 } 2296 }
2293 selDates = KGlobal::locale()->formatDate( date, true); 2297 selDates = KGlobal::locale()->formatDate( date, true);
2294 if (mView->startDate() < mView->endDate() ) 2298 if (mView->startDate() < mView->endDate() )
2295 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2299 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2296 else { 2300 else {
2297 QString addString; 2301 QString addString;
2298 if ( date == QDateTime::currentDateTime().date() ) 2302 if ( date == QDateTime::currentDateTime().date() )
2299 addString = i18n("Today"); 2303 addString = i18n("Today");
2300 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2304 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2301 addString = i18n("Tomorrow"); 2305 addString = i18n("Tomorrow");
2302 if ( !addString.isEmpty() ) 2306 if ( !addString.isEmpty() )
2303 selDates = addString+", "+selDates ; 2307 selDates = addString+", "+selDates ;
2304 } 2308 }
2305 setCaption( i18n("Dates: ") + selDates ); 2309 setCaption( i18n("Dates: ") + selDates );
2306 2310
2307} 2311}
2308void MainWindow::showConfigureAgenda( ) 2312void MainWindow::showConfigureAgenda( )
2309{ 2313{
2310 int iii; 2314 int iii;
2311 for ( iii = 1;iii<= 10 ;++iii ){ 2315 for ( iii = 1;iii<= 10 ;++iii ){
2312 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2316 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2313 } 2317 }
2314 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2318 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2315} 2319}
2316void MainWindow::configureAgenda( int item ) 2320void MainWindow::configureAgenda( int item )
2317{ 2321{
2318 if ( KOPrefs::instance()->mHourSize == item ) 2322 if ( KOPrefs::instance()->mHourSize == item )
2319 return; 2323 return;
2320 KOPrefs::instance()->mHourSize=item; 2324 KOPrefs::instance()->mHourSize=item;
2321 mView->viewManager()->agendaView()->updateConfig(); 2325 mView->viewManager()->agendaView()->updateConfig();
2322} 2326}
2323 2327
2324void MainWindow::saveCalendar() 2328void MainWindow::saveCalendar()
2325{ 2329{
2326 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 2330 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
2327 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 2331 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
2328 bupDir = KGlobalSettings::backupDataDir(); 2332 bupDir = KGlobalSettings::backupDataDir();
2329 bupDir = KGlobal::formatMessage ( bupDir, 0 ); 2333 bupDir = KGlobal::formatMessage ( bupDir, 0 );
2330 QString bupHint; 2334 QString bupHint;
2331 if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) 2335 if ( !KPimGlobalPrefs::instance()->mBackupEnabled )
2332 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); 2336 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)");
2333 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; 2337 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return;
2334 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; 2338 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled;
2335 KPimGlobalPrefs::instance()->mBackupEnabled = false; 2339 KPimGlobalPrefs::instance()->mBackupEnabled = false;
2336 save(); 2340 save();
2337 KPimGlobalPrefs::instance()->mBackupEnabled = enabled; 2341 KPimGlobalPrefs::instance()->mBackupEnabled = enabled;
2338 backupAllFiles(); 2342 backupAllFiles();
2339} 2343}
2340void MainWindow::loadCalendar() 2344void MainWindow::loadCalendar()
2341{ 2345{
2342 2346
2343 2347
2344#if 0 2348#if 0
2345 QString fn = KOPrefs::instance()->mLastLoadFile; 2349 QString fn = KOPrefs::instance()->mLastLoadFile;
2346 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2350 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2347 2351
2348 if ( fn == "" ) 2352 if ( fn == "" )
2349 return; 2353 return;
2350 QFileInfo info; 2354 QFileInfo info;
2351 info.setFile( fn ); 2355 info.setFile( fn );
2352 QString mess; 2356 QString mess;
2353 bool loadbup = true; 2357 bool loadbup = true;
2354 if ( info. exists() ) { 2358 if ( info. exists() ) {
2355 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2359 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2356 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2360 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2357 mess, 2361 mess,
2358 i18n("Load!"), i18n("Cancel"), 0, 2362 i18n("Load!"), i18n("Cancel"), 0,
2359 0, 1 ); 2363 0, 1 );
2360 if ( result != 0 ) { 2364 if ( result != 0 ) {
2361 loadbup = false; 2365 loadbup = false;
2362 } 2366 }
2363 } else { 2367 } else {
2364 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2368 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2365 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2369 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2366 0, 1 ); 2370 0, 1 );
2367 2371
2368 return; 2372 return;
2369 } 2373 }
2370 if ( loadbup ) { 2374 if ( loadbup ) {
2371 mView->openCalendar( fn ); 2375 mView->openCalendar( fn );
2372 KOPrefs::instance()->mLastLoadFile = fn; 2376 KOPrefs::instance()->mLastLoadFile = fn;
2373 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2377 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2374 setCaption(mess); 2378 setCaption(mess);
2375 } 2379 }
2376#endif 2380#endif
2377 2381
2378} 2382}
2379void MainWindow::quickImportIcal() 2383void MainWindow::quickImportIcal()
2380{ 2384{
2381 importFile( KOPrefs::instance()->mLastImportFile, false ); 2385 importFile( KOPrefs::instance()->mLastImportFile, false );
2382} 2386}
2383void MainWindow::importFile( QString fn, bool quick ) 2387void MainWindow::importFile( QString fn, bool quick )
2384{ 2388{
2385 QFileInfo info; 2389 QFileInfo info;
2386 info.setFile( fn ); 2390 info.setFile( fn );
2387 QString mess; 2391 QString mess;
2388 bool loadbup = true; 2392 bool loadbup = true;
2389 if ( !info. exists() ) { 2393 if ( !info. exists() ) {
2390 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2394 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2391 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2395 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2392 mess ); 2396 mess );
2393 return; 2397 return;
2394 } 2398 }
2395 int result = 0; 2399 int result = 0;
2396 if ( !quick ) { 2400 if ( !quick ) {
2397 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2401 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2398 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2402 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2399 mess, 2403 mess,
2400 "Import", "Cancel", 0, 2404 "Import", "Cancel", 0,
2401 0, 1 ); 2405 0, 1 );
2402 } 2406 }
2403 if ( result == 0 ) { 2407 if ( result == 0 ) {
2404 if ( mView->openCalendar( fn, true )) { 2408 if ( mView->openCalendar( fn, true )) {
2405 KOPrefs::instance()->mLastImportFile = fn; 2409 KOPrefs::instance()->mLastImportFile = fn;
2406 setCaption(i18n("Imported file successfully")); 2410 setCaption(i18n("Imported file successfully"));
2407 } else { 2411 } else {
2408 setCaption(i18n("Error importing file")); 2412 setCaption(i18n("Error importing file"));
2409 } 2413 }
2410 } 2414 }
2411} 2415}
2412 2416
2413void MainWindow::importIcal() 2417void MainWindow::importIcal()
2414{ 2418{
2415 2419
2416 QString fn =KOPrefs::instance()->mLastImportFile; 2420 QString fn =KOPrefs::instance()->mLastImportFile;
2417 2421
2418 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2422 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2419 if ( fn == "" ) 2423 if ( fn == "" )
2420 return; 2424 return;
2421 importFile( fn, true ); 2425 importFile( fn, true );
2422 2426
2423} 2427}
2424 2428
2425void MainWindow::exportVCalendar() 2429void MainWindow::exportVCalendar()
2426{ 2430{
2427 QString fn = KOPrefs::instance()->mLastVcalFile; 2431 QString fn = KOPrefs::instance()->mLastVcalFile;
2428 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2432 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2429 if ( fn == "" ) 2433 if ( fn == "" )
2430 return; 2434 return;
2431 QFileInfo info; 2435 QFileInfo info;
2432 info.setFile( fn ); 2436 info.setFile( fn );
2433 QString mes; 2437 QString mes;
2434 bool createbup = true; 2438 bool createbup = true;
2435 if ( info. exists() ) { 2439 if ( info. exists() ) {
2436 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2440 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2437 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2441 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2438 i18n("Overwrite!"), i18n("Cancel"), 0, 2442 i18n("Overwrite!"), i18n("Cancel"), 0,
2439 0, 1 ); 2443 0, 1 );
2440 if ( result != 0 ) { 2444 if ( result != 0 ) {
2441 createbup = false; 2445 createbup = false;
2442 } 2446 }
2443 } 2447 }
2444 if ( createbup ) { 2448 if ( createbup ) {
2445 if ( mView->exportVCalendar( fn ) ) { 2449 if ( mView->exportVCalendar( fn ) ) {
2446 KOPrefs::instance()->mLastVcalFile = fn; 2450 KOPrefs::instance()->mLastVcalFile = fn;
2447 if ( fn.length() > 20 ) 2451 if ( fn.length() > 20 )
2448 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2452 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2449 else 2453 else
2450 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2454 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2451 setCaption(mes); 2455 setCaption(mes);
2452 } 2456 }
2453 } 2457 }
2454 2458
2455} 2459}
2456QString MainWindow::sentSyncFile() 2460QString MainWindow::sentSyncFile()
2457{ 2461{
2458#ifdef DESKTOP_VERSION 2462#ifdef DESKTOP_VERSION
2459 return locateLocal( "tmp", "copysynccal.ics" ); 2463 return locateLocal( "tmp", "copysynccal.ics" );
2460#else 2464#else
2461 return QString( "/tmp/copysynccal.ics" ); 2465 return QString( "/tmp/copysynccal.ics" );
2462#endif 2466#endif
2463} 2467}
2464 2468
2465void MainWindow::syncFileRequest() 2469void MainWindow::syncFileRequest()
2466{ 2470{
2467 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2471 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2468 mSyncManager->slotSyncMenu( 999 ); 2472 mSyncManager->slotSyncMenu( 999 );
2469 } 2473 }
2470 2474
2471 setCaption(i18n("Saving Data to temp file ..." )); 2475 setCaption(i18n("Saving Data to temp file ..." ));
2472 mView->saveCalendar( sentSyncFile() ); 2476 mView->saveCalendar( sentSyncFile() );
2473 setCaption(i18n("Data saved to temp file!" )); 2477 setCaption(i18n("Data saved to temp file!" ));
2474 2478
2475} 2479}
2476void MainWindow::getFile( bool success ) 2480void MainWindow::getFile( bool success )
2477{ 2481{
2478 if ( ! success ) { 2482 if ( ! success ) {
2479 setCaption( i18n("Error receiving file. Nothing changed!") ); 2483 setCaption( i18n("Error receiving file. Nothing changed!") );
2480 return; 2484 return;
2481 } 2485 }
2482 mView->openCalendar( sentSyncFile() ); 2486 mView->openCalendar( sentSyncFile() );
2483 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2487 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2484 mSyncManager->slotSyncMenu( 999 ); 2488 mSyncManager->slotSyncMenu( 999 );
2485 } 2489 }
2486 setCaption( i18n("Pi-Sync successful!") ); 2490 setCaption( i18n("Pi-Sync successful!") );
2487} 2491}
2488void MainWindow::printListView() 2492void MainWindow::printListView()
2489{ 2493{
2490 2494
2491 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); 2495 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.");
2492 2496
2493 KMessageBox::information( this, message); 2497 KMessageBox::information( this, message);
2494} 2498}
2495void MainWindow::printSel( ) 2499void MainWindow::printSel( )
2496{ 2500{
2497 mView->viewManager()->agendaView()->agenda()->printSelection(); 2501 mView->viewManager()->agendaView()->agenda()->printSelection();
2498} 2502}
2499 2503
2500void MainWindow::printCal() 2504void MainWindow::printCal()
2501{ 2505{
2502 mView->print();//mCp->showDialog(); 2506 mView->print();//mCp->showDialog();
2503} 2507}
2504 2508
2505 2509
2506#include "libkdepim/kdatepicker.h" 2510#include "libkdepim/kdatepicker.h"
2507#include <kdatetbl.h> 2511#include <kdatetbl.h>
2508 2512
2509void MainWindow::weekAction() 2513void MainWindow::weekAction()
2510{ 2514{
2511 int month; 2515 int month;
2512 KPopupFrame* popup = new KPopupFrame(this); 2516 KPopupFrame* popup = new KPopupFrame(this);
2513 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2517 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2514 // ----- 2518 // -----
2515 picker->resize(picker->sizeHint()); 2519 picker->resize(picker->sizeHint());
2516 popup->setMainWidget(picker); 2520 popup->setMainWidget(picker);
2517 picker->setFocus(); 2521 picker->setFocus();
2518 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2522 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2519 int x = 0; 2523 int x = 0;
2520 int y = iconToolBar->height(); 2524 int y = iconToolBar->height();
2521 int dX = 0; 2525 int dX = 0;
2522 int dY = 0; 2526 int dY = 0;
2523 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2527 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2524 if ( iconToolBar->y() > height()/2 ) { 2528 if ( iconToolBar->y() > height()/2 ) {
2525 dY = picker->sizeHint().height()+8; 2529 dY = picker->sizeHint().height()+8;
2526 y = 0; 2530 y = 0;
2527 } 2531 }
2528 } else { 2532 } else {
2529 if ( iconToolBar->x() > width()/2 ) { // right side 2533 if ( iconToolBar->x() > width()/2 ) { // right side
2530 x=0; 2534 x=0;
2531 dX= picker->sizeHint().width()+8; 2535 dX= picker->sizeHint().width()+8;
2532 y = 0; 2536 y = 0;
2533 } else { 2537 } else {
2534 x= iconToolBar->width(); 2538 x= iconToolBar->width();
2535 y = 0; 2539 y = 0;
2536 } 2540 }
2537 } 2541 }
2538 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2542 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2539 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2543 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2540 { 2544 {
2541 month = picker->getResult(); 2545 month = picker->getResult();
2542 emit selectWeek ( month ); 2546 emit selectWeek ( month );
2543 //qDebug("weekSelected %d ", month); 2547 //qDebug("weekSelected %d ", month);
2544 } 2548 }
2545 delete popup; 2549 delete popup;
2546} 2550}
2547 2551
2548void MainWindow::hideEvent ( QHideEvent * ) 2552void MainWindow::hideEvent ( QHideEvent * )
2549{ 2553{
2550 QString message; 2554 QString message;
2551 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2555 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2552 if ( nextA.isValid() ) { 2556 if ( nextA.isValid() ) {
2553 QString sum = mCalendar->nextSummary(); 2557 QString sum = mCalendar->nextSummary();
2554 2558
2555 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2559 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2556 setCaption( message ); 2560 setCaption( message );
2557 } 2561 }
2558} 2562}
2559 2563
2560void MainWindow::resizeEvent( QResizeEvent* e) 2564void MainWindow::resizeEvent( QResizeEvent* e)
2561{ 2565{
2562#ifndef DESKTOP_VERSION 2566#ifndef DESKTOP_VERSION
2563 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { 2567 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2564 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2568 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2565 filterToolBar->hide(); 2569 filterToolBar->hide();
2566 else 2570 else
2567 filterToolBar->show(); 2571 filterToolBar->show();
2568 } 2572 }
2569#endif 2573#endif
2570 QMainWindow::resizeEvent( e); 2574 QMainWindow::resizeEvent( e);
2571} 2575}