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
@@ -70,206 +70,207 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
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,241 +1,242 @@
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 }
@@ -1645,449 +1646,452 @@ void MainWindow::processIncidenceSelection( Incidence *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();