summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-30 06:57:43 (UTC)
committer zautrix <zautrix>2005-06-30 06:57:43 (UTC)
commit0bcf4379652b763423d0c1843cb8ab8945b798bd (patch) (unidiff)
tree3a0d6457c8457204423c1aa0c9946de479f79881 /korganizer
parent0e4ec4bb2a13a89d3d6145ea076a5734481cb252 (diff)
downloadkdepimpi-0bcf4379652b763423d0c1843cb8ab8945b798bd.zip
kdepimpi-0bcf4379652b763423d0c1843cb8ab8945b798bd.tar.gz
kdepimpi-0bcf4379652b763423d0c1843cb8ab8945b798bd.tar.bz2
fixxx
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kojournalview.cpp1
-rw-r--r--korganizer/mainwindow.cpp6
2 files changed, 2 insertions, 5 deletions
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index 51ae0a0..7a96aa5 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -1,236 +1,235 @@
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}
121void KOJournalView::checkModified() 121void KOJournalView::checkModified()
122{ 122{
123 qDebug("checkmod ");
124 flushView(); 123 flushView();
125} 124}
126void KOJournalView::flushView() 125void KOJournalView::flushView()
127{ 126{
128 static bool ff = false; 127 static bool ff = false;
129 if ( ff ) return; 128 if ( ff ) return;
130 ff = true; 129 ff = true;
131 JournalEntry* mEntry = jEntries.first(); 130 JournalEntry* mEntry = jEntries.first();
132 while ( mEntry ) { 131 while ( mEntry ) {
133 mEntry->flushEntry(); 132 mEntry->flushEntry();
134 mEntry = jEntries.next(); 133 mEntry = jEntries.next();
135 } 134 }
136 ff = false; 135 ff = false;
137} 136}
138 137
139void KOJournalView::clearList() 138void KOJournalView::clearList()
140{ 139{
141 JournalEntry* mEntry = jEntries.first(); 140 JournalEntry* mEntry = jEntries.first();
142 while ( mEntry ) { 141 while ( mEntry ) {
143 mEntry->clear(); 142 mEntry->clear();
144 mEntry = jEntries.next(); 143 mEntry = jEntries.next();
145 } 144 }
146} 145}
147void KOJournalView::newJournal() 146void KOJournalView::newJournal()
148{ 147{
149 //qDebug(" KOJournalView::newJournal()"); 148 //qDebug(" KOJournalView::newJournal()");
150 flushView(); 149 flushView();
151 Journal* mJournal = new Journal; 150 Journal* mJournal = new Journal;
152 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); 151 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
153 mCalendar->addJournal(mJournal); 152 mCalendar->addJournal(mJournal);
154 showDates( mDate, QDate() ); 153 showDates( mDate, QDate() );
155} 154}
156 155
157void KOJournalView::showOnly ( Journal* j ) 156void KOJournalView::showOnly ( Journal* j )
158{ 157{
159 //qDebug("showOnly %x ", j); 158 //qDebug("showOnly %x ", j);
160 flushView(); 159 flushView();
161 if ( j == 0 ) { 160 if ( j == 0 ) {
162 showDates( mDate, QDate() ); 161 showDates( mDate, QDate() );
163 return; 162 return;
164 } 163 }
165 QPtrList<Journal> jl; 164 QPtrList<Journal> jl;
166 jl.append ( j ); 165 jl.append ( j );
167 showList( jl ); 166 showList( jl );
168 JournalEntry* mEntry = jEntries.first(); 167 JournalEntry* mEntry = jEntries.first();
169 mEntry->setShowOnly(); 168 mEntry->setShowOnly();
170} 169}
171void KOJournalView::showList(QPtrList<Journal> jl) 170void KOJournalView::showList(QPtrList<Journal> jl)
172{ 171{
173 //qDebug("KOJournalView::showList %d",jl.count() ); 172 //qDebug("KOJournalView::showList %d",jl.count() );
174 JournalEntry* mEntry = jEntries.first(); 173 JournalEntry* mEntry = jEntries.first();
175 JournalEntry* firstEntry = mEntry; 174 JournalEntry* firstEntry = mEntry;
176 int count = jl.count(); 175 int count = jl.count();
177 int iii = 0; 176 int iii = 0;
178 while ( iii < count ) { 177 while ( iii < count ) {
179 if ( !mEntry ) { 178 if ( !mEntry ) {
180 mEntry = getNewEntry(); 179 mEntry = getNewEntry();
181 mEntry->show(); 180 mEntry->show();
182 mEntry->setVisibleMode( true ); 181 mEntry->setVisibleMode( true );
183 mEntry->setDate(mDate); 182 mEntry->setDate(mDate);
184 mEntry->setJournal(jl.at(iii)); 183 mEntry->setJournal(jl.at(iii));
185 mEntry = 0; 184 mEntry = 0;
186 } else { 185 } else {
187 mEntry->setDate(mDate); 186 mEntry->setDate(mDate);
188 mEntry->setJournal(jl.at(iii)); 187 mEntry->setJournal(jl.at(iii));
189 mEntry->show(); 188 mEntry->show();
190 mEntry->setVisibleMode( true ); 189 mEntry->setVisibleMode( true );
191 mEntry = jEntries.next(); 190 mEntry = jEntries.next();
192 } 191 }
193 ++iii; 192 ++iii;
194 } 193 }
195 while ( mEntry ) { 194 while ( mEntry ) {
196 mEntry->setDate(mDate); 195 mEntry->setDate(mDate);
197 mEntry->clear(); 196 mEntry->clear();
198 if ( mEntry != firstEntry ) { 197 if ( mEntry != firstEntry ) {
199 mEntry->hide(); 198 mEntry->hide();
200 mEntry->setVisibleMode( false ); 199 mEntry->setVisibleMode( false );
201 } 200 }
202 else { 201 else {
203 mEntry->setVisibleMode( true ); 202 mEntry->setVisibleMode( true );
204 mEntry->show(); 203 mEntry->show();
205 } 204 }
206 mEntry = jEntries.next(); 205 mEntry = jEntries.next();
207 } 206 }
208} 207}
209 208
210void KOJournalView::showDates(const QDate &start, const QDate &) 209void KOJournalView::showDates(const QDate &start, const QDate &)
211{ 210{
212 mDate = start; 211 mDate = start;
213 mDateLabel-> setText(KGlobal::locale()->formatDate(mDate)); 212 mDateLabel-> setText(KGlobal::locale()->formatDate(mDate));
214 QPtrList<Journal> jl = calendar()->journals4Date( start ); 213 QPtrList<Journal> jl = calendar()->journals4Date( start );
215 showList( jl ); 214 showList( jl );
216} 215}
217 216
218void KOJournalView::showEvents(QPtrList<Event>) 217void KOJournalView::showEvents(QPtrList<Event>)
219{ 218{
220 // After new creation of list view no events are selected. 219 // After new creation of list view no events are selected.
221// emit incidenceSelected( 0 ); 220// emit incidenceSelected( 0 );
222} 221}
223 222
224void KOJournalView::changeEventDisplay(Event *, int /*action*/) 223void KOJournalView::changeEventDisplay(Event *, int /*action*/)
225{ 224{
226 updateView(); 225 updateView();
227} 226}
228 227
229void KOJournalView::keyPressEvent ( QKeyEvent * e ) 228void KOJournalView::keyPressEvent ( QKeyEvent * e )
230{ 229{
231 //qDebug("keyPressEven "); 230 //qDebug("keyPressEven ");
232 if ( e->state() == Qt::ControlButton ) { 231 if ( e->state() == Qt::ControlButton ) {
233 if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left ) 232 if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left )
234 e->ignore(); 233 e->ignore();
235 } 234 }
236} 235}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index fb6d6ec..23537a6 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,2575 +1,2573 @@
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 "kojournalview.h"
51#include "koagenda.h" 51#include "koagenda.h"
52#include "kodialogmanager.h" 52#include "kodialogmanager.h"
53#include "kdialogbase.h" 53#include "kdialogbase.h"
54#include "kapplication.h" 54#include "kapplication.h"
55#include "kofilterview.h" 55#include "kofilterview.h"
56#include "kstandarddirs.h" 56#include "kstandarddirs.h"
57#include "koprefs.h" 57#include "koprefs.h"
58#include "kfiledialog.h" 58#include "kfiledialog.h"
59#include "koglobals.h" 59#include "koglobals.h"
60#include "kglobal.h" 60#include "kglobal.h"
61#include "ktoolbar.h" 61#include "ktoolbar.h"
62#include "klocale.h" 62#include "klocale.h"
63#include "kconfig.h" 63#include "kconfig.h"
64#include "externalapphandler.h" 64#include "externalapphandler.h"
65#include <kglobalsettings.h> 65#include <kglobalsettings.h>
66 66
67using namespace KCal; 67using namespace KCal;
68#ifndef _WIN32_ 68#ifndef _WIN32_
69#include <unistd.h> 69#include <unistd.h>
70#else 70#else
71#ifdef _OL_IMPORT_ 71#ifdef _OL_IMPORT_
72#include "koimportoldialog.h" 72#include "koimportoldialog.h"
73#endif 73#endif
74#endif 74#endif
75#include "mainwindow.h" 75#include "mainwindow.h"
76 76
77 77
78class KOex2phonePrefs : public QDialog 78class KOex2phonePrefs : public QDialog
79{ 79{
80 public: 80 public:
81 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 81 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
82 QDialog( parent, name, true ) 82 QDialog( parent, name, true )
83 { 83 {
84 setCaption( i18n("Export to phone options") ); 84 setCaption( i18n("Export to phone options") );
85 QVBoxLayout* lay = new QVBoxLayout( this ); 85 QVBoxLayout* lay = new QVBoxLayout( this );
86 lay->setSpacing( 3 ); 86 lay->setSpacing( 3 );
87 lay->setMargin( 3 ); 87 lay->setMargin( 3 );
88 QLabel *lab; 88 QLabel *lab;
89 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 ) );
90 lab->setAlignment (AlignHCenter ); 90 lab->setAlignment (AlignHCenter );
91 QHBox* temphb; 91 QHBox* temphb;
92 temphb = new QHBox( this ); 92 temphb = new QHBox( this );
93 new QLabel( i18n("I/O device: "), temphb ); 93 new QLabel( i18n("I/O device: "), temphb );
94 mPhoneDevice = new QLineEdit( temphb); 94 mPhoneDevice = new QLineEdit( temphb);
95 lay->addWidget( temphb ); 95 lay->addWidget( temphb );
96 temphb = new QHBox( this ); 96 temphb = new QHBox( this );
97 new QLabel( i18n("Connection: "), temphb ); 97 new QLabel( i18n("Connection: "), temphb );
98 mPhoneConnection = new QLineEdit( temphb); 98 mPhoneConnection = new QLineEdit( temphb);
99 lay->addWidget( temphb ); 99 lay->addWidget( temphb );
100 temphb = new QHBox( this ); 100 temphb = new QHBox( this );
101 new QLabel( i18n("Model(opt.): "), temphb ); 101 new QLabel( i18n("Model(opt.): "), temphb );
102 mPhoneModel = new QLineEdit( temphb); 102 mPhoneModel = new QLineEdit( temphb);
103 lay->addWidget( temphb ); 103 lay->addWidget( temphb );
104 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 104 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
105 mWriteBackFuture->setChecked( true ); 105 mWriteBackFuture->setChecked( true );
106 lay->addWidget( mWriteBackFuture ); 106 lay->addWidget( mWriteBackFuture );
107 temphb = new QHBox( this ); 107 temphb = new QHBox( this );
108 new QLabel( i18n("Max. weeks in future: ") , temphb ); 108 new QLabel( i18n("Max. weeks in future: ") , temphb );
109 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 109 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
110 mWriteBackFutureWeeks->setValue( 8 ); 110 mWriteBackFutureWeeks->setValue( 8 );
111 lay->addWidget( temphb ); 111 lay->addWidget( temphb );
112 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 ) );
113 lab->setAlignment (AlignHCenter ); 113 lab->setAlignment (AlignHCenter );
114 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 114 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
115 lay->addWidget( ok ); 115 lay->addWidget( ok );
116 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 116 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
117 lay->addWidget( cancel ); 117 lay->addWidget( cancel );
118 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 118 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
119 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 119 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
120 resize( 220, 240 ); 120 resize( 220, 240 );
121 qApp->processEvents(); 121 qApp->processEvents();
122 int dw = QApplication::desktop()->width(); 122 int dw = QApplication::desktop()->width();
123 int dh = QApplication::desktop()->height(); 123 int dh = QApplication::desktop()->height();
124 move( (dw-width())/2, (dh - height() )/2 ); 124 move( (dw-width())/2, (dh - height() )/2 );
125 } 125 }
126 126
127public: 127public:
128 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 128 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
129 QCheckBox* mWriteBackFuture; 129 QCheckBox* mWriteBackFuture;
130 QSpinBox* mWriteBackFutureWeeks; 130 QSpinBox* mWriteBackFutureWeeks;
131}; 131};
132 132
133QPixmap* sgListViewCompletedPix[6]; 133QPixmap* sgListViewCompletedPix[6];
134 134
135 135
136int globalFlagBlockStartup; 136int globalFlagBlockStartup;
137MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 137MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
138 QMainWindow( parent, name ) 138 QMainWindow( parent, name )
139{ 139{
140 sgListViewCompletedPix[5] = &listviewPix; 140 sgListViewCompletedPix[5] = &listviewPix;
141 sgListViewCompletedPix[0] = &listviewPix0; 141 sgListViewCompletedPix[0] = &listviewPix0;
142 sgListViewCompletedPix[1] = &listviewPix20; 142 sgListViewCompletedPix[1] = &listviewPix20;
143 sgListViewCompletedPix[2] = &listviewPix40; 143 sgListViewCompletedPix[2] = &listviewPix40;
144 sgListViewCompletedPix[3] = &listviewPix60; 144 sgListViewCompletedPix[3] = &listviewPix60;
145 sgListViewCompletedPix[4] = &listviewPix80; 145 sgListViewCompletedPix[4] = &listviewPix80;
146 if ( sgListViewCompletedPix[5]->height() < 5 ) { 146 if ( sgListViewCompletedPix[5]->height() < 5 ) {
147 int size = 12; 147 int size = 12;
148 sgListViewCompletedPix[5]->resize( 11, 11 ); 148 sgListViewCompletedPix[5]->resize( 11, 11 );
149 sgListViewCompletedPix[5]->fill( Qt::white ); 149 sgListViewCompletedPix[5]->fill( Qt::white );
150 QPainter p ( sgListViewCompletedPix[5] ); 150 QPainter p ( sgListViewCompletedPix[5] );
151 p.drawRect( 0,0,11,11); 151 p.drawRect( 0,0,11,11);
152 int half = size/2; 152 int half = size/2;
153 int heihei = size/2; 153 int heihei = size/2;
154 int x = 1; 154 int x = 1;
155 p.drawLine ( 2, 5, 4 , 7 ) ; 155 p.drawLine ( 2, 5, 4 , 7 ) ;
156 p.drawLine ( 4 , 7 , 8, 3) ; 156 p.drawLine ( 4 , 7 , 8, 3) ;
157 int iii = 0; 157 int iii = 0;
158 for ( iii = 0; iii < 5; ++iii ) { 158 for ( iii = 0; iii < 5; ++iii ) {
159 sgListViewCompletedPix[iii]->resize( 11, 11 ); 159 sgListViewCompletedPix[iii]->resize( 11, 11 );
160 sgListViewCompletedPix[iii]->fill( Qt::white ); 160 sgListViewCompletedPix[iii]->fill( Qt::white );
161 QPainter p ( sgListViewCompletedPix[iii] ); 161 QPainter p ( sgListViewCompletedPix[iii] );
162 p.drawRect( 0,0,11,11); 162 p.drawRect( 0,0,11,11);
163 if ( iii ) 163 if ( iii )
164 p.fillRect( 1,1,iii*2,9,Qt::gray ); 164 p.fillRect( 1,1,iii*2,9,Qt::gray );
165 } 165 }
166 } 166 }
167 mClosed = false; 167 mClosed = false;
168 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 168 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
169 QString confFile = locateLocal("config","korganizerrc"); 169 QString confFile = locateLocal("config","korganizerrc");
170 QFileInfo finf ( confFile ); 170 QFileInfo finf ( confFile );
171 bool showWarning = !finf.exists(); 171 bool showWarning = !finf.exists();
172 setIcon(SmallIcon( "ko24" ) ); 172 setIcon(SmallIcon( "ko24" ) );
173 mBlockAtStartup = true; 173 mBlockAtStartup = true;
174 mFlagKeyPressed = false; 174 mFlagKeyPressed = false;
175 setCaption("KO/Pi"); 175 setCaption("KO/Pi");
176 KOPrefs *p = KOPrefs::instance(); 176 KOPrefs *p = KOPrefs::instance();
177 //KPimGlobalPrefs::instance()->setGlobalConfig(); 177 //KPimGlobalPrefs::instance()->setGlobalConfig();
178 p->mCurrentDisplayedView = 0; 178 p->mCurrentDisplayedView = 0;
179 if ( p->mHourSize > 22 ) 179 if ( p->mHourSize > 22 )
180 p->mHourSize = 22; 180 p->mHourSize = 22;
181 QMainWindow::ToolBarDock tbd; 181 QMainWindow::ToolBarDock tbd;
182 if ( p->mToolBarHor ) { 182 if ( p->mToolBarHor ) {
183 if ( p->mToolBarUp ) 183 if ( p->mToolBarUp )
184 tbd = Bottom; 184 tbd = Bottom;
185 else 185 else
186 tbd = Top; 186 tbd = Top;
187 } 187 }
188 else { 188 else {
189 if ( p->mToolBarUp ) 189 if ( p->mToolBarUp )
190 tbd = Right; 190 tbd = Right;
191 else 191 else
192 tbd = Left; 192 tbd = Left;
193 } 193 }
194 if ( KOPrefs::instance()->mUseAppColors ) 194 if ( KOPrefs::instance()->mUseAppColors )
195 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 195 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
196 globalFlagBlockStartup = 1; 196 globalFlagBlockStartup = 1;
197 iconToolBar = new QPEToolBar( this ); 197 iconToolBar = new QPEToolBar( this );
198 addToolBar (iconToolBar , tbd ); 198 addToolBar (iconToolBar , tbd );
199 199
200#ifdef DESKTOP_VERSION 200#ifdef DESKTOP_VERSION
201 if ( KOPrefs::instance()->mShowIconFilter ) 201 if ( KOPrefs::instance()->mShowIconFilter )
202#else 202#else
203 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) 203 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar )
204#endif 204#endif
205 205
206{ 206{
207 if ( p->mToolBarHorF ) { 207 if ( p->mToolBarHorF ) {
208 if ( p->mToolBarUpF ) 208 if ( p->mToolBarUpF )
209 tbd = Bottom; 209 tbd = Bottom;
210 else 210 else
211 tbd = Top; 211 tbd = Top;
212 } 212 }
213 else { 213 else {
214 if ( p->mToolBarUpF ) 214 if ( p->mToolBarUpF )
215 tbd = Right; 215 tbd = Right;
216 else 216 else
217 tbd = Left; 217 tbd = Left;
218 } 218 }
219 filterToolBar = new QPEToolBar ( this ); 219 filterToolBar = new QPEToolBar ( this );
220 filterMenubar = new QMenuBar( 0 ); 220 filterMenubar = new QMenuBar( 0 );
221 QFontMetrics fm ( filterMenubar->font() ); 221 QFontMetrics fm ( filterMenubar->font() );
222 222
223 filterPopupMenu = new QPopupMenu( this ); 223 filterPopupMenu = new QPopupMenu( this );
224 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 224 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
225 QString addTest = "A"; 225 QString addTest = "A";
226 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 226 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
227#ifdef DESKTOP_VERSION 227#ifdef DESKTOP_VERSION
228 addTest = "AAABBBCCCx"; 228 addTest = "AAABBBCCCx";
229#else 229#else
230 addTest = "AAx"; 230 addTest = "AAx";
231#endif 231#endif
232 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 232 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
233 addToolBar (filterToolBar , tbd ); 233 addToolBar (filterToolBar , tbd );
234 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 234 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
235 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 235 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
236 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 236 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
237 filterToolBar->hide(); 237 filterToolBar->hide();
238 } else { 238 } else {
239 filterToolBar = 0; 239 filterToolBar = 0;
240 filterMenubar = 0; 240 filterMenubar = 0;
241 filterPopupMenu = 0; 241 filterPopupMenu = 0;
242 } 242 }
243 if ( p->mShowIconOnetoolbar ) { 243 if ( p->mShowIconOnetoolbar ) {
244 viewToolBar = iconToolBar ; 244 viewToolBar = iconToolBar ;
245 navigatorToolBar = iconToolBar ; 245 navigatorToolBar = iconToolBar ;
246 } else { 246 } else {
247#ifndef DESKTOP_VERSION 247#ifndef DESKTOP_VERSION
248 setToolBarsMovable( false ); 248 setToolBarsMovable( false );
249#endif 249#endif
250 if ( p->mToolBarHorV ) { 250 if ( p->mToolBarHorV ) {
251 if ( p->mToolBarUpV ) 251 if ( p->mToolBarUpV )
252 tbd = Bottom; 252 tbd = Bottom;
253 else 253 else
254 tbd = Top; 254 tbd = Top;
255 } 255 }
256 else { 256 else {
257 if ( p->mToolBarUpV ) 257 if ( p->mToolBarUpV )
258 tbd = Right; 258 tbd = Right;
259 else 259 else
260 tbd = Left; 260 tbd = Left;
261 } 261 }
262 viewToolBar = new QPEToolBar( this ); 262 viewToolBar = new QPEToolBar( this );
263 addToolBar (viewToolBar , tbd ); 263 addToolBar (viewToolBar , tbd );
264 if ( p->mToolBarHorN ) { 264 if ( p->mToolBarHorN ) {
265 if ( p->mToolBarUpN ) 265 if ( p->mToolBarUpN )
266 tbd = Bottom; 266 tbd = Bottom;
267 else 267 else
268 tbd = Top; 268 tbd = Top;
269 } 269 }
270 else { 270 else {
271 if ( p->mToolBarUpN ) 271 if ( p->mToolBarUpN )
272 tbd = Right; 272 tbd = Right;
273 else 273 else
274 tbd = Left; 274 tbd = Left;
275 } 275 }
276 navigatorToolBar = new QPEToolBar( this ); 276 navigatorToolBar = new QPEToolBar( this );
277 addToolBar (navigatorToolBar , tbd ); 277 addToolBar (navigatorToolBar , tbd );
278 } 278 }
279 279
280 280
281 281
282 mCalendarModifiedFlag = false; 282 mCalendarModifiedFlag = false;
283 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 283 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
284 splash->setAlignment ( AlignCenter ); 284 splash->setAlignment ( AlignCenter );
285 setCentralWidget( splash ); 285 setCentralWidget( splash );
286#ifndef DESKTOP_VERSION 286#ifndef DESKTOP_VERSION
287 showMaximized(); 287 showMaximized();
288#endif 288#endif
289 289
290 //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 ());
291 setDefaultPreferences(); 291 setDefaultPreferences();
292 mCalendar = new CalendarLocal(); 292 mCalendar = new CalendarLocal();
293 mView = new CalendarView( mCalendar, this,"mCalendar " ); 293 mView = new CalendarView( mCalendar, this,"mCalendar " );
294 mView->hide(); 294 mView->hide();
295 //mView->resize(splash->size() ); 295 //mView->resize(splash->size() );
296 initActions(); 296 initActions();
297 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);
298 mSyncManager->setBlockSave(false); 298 mSyncManager->setBlockSave(false);
299 mView->setSyncManager(mSyncManager); 299 mView->setSyncManager(mSyncManager);
300#ifndef DESKTOP_VERSION 300#ifndef DESKTOP_VERSION
301 iconToolBar->show(); 301 iconToolBar->show();
302 qApp->processEvents(); 302 qApp->processEvents();
303#endif 303#endif
304 //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 ());
305 int vh = height() ; 305 int vh = height() ;
306 int vw = width(); 306 int vw = width();
307 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 307 //qDebug("Toolbar hei %d ",iconToolBar->height() );
308 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 308 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
309 vh -= iconToolBar->height(); 309 vh -= iconToolBar->height();
310 } else { 310 } else {
311 vw -= iconToolBar->height(); 311 vw -= iconToolBar->height();
312 } 312 }
313 //mView->setMaximumSize( splash->size() ); 313 //mView->setMaximumSize( splash->size() );
314 //mView->resize( splash->size() ); 314 //mView->resize( splash->size() );
315 //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 ());
316 mView->readSettings(); 316 mView->readSettings();
317 bool newFile = false; 317 bool newFile = false;
318 if( !QFile::exists( defaultFileName() ) ) { 318 if( !QFile::exists( defaultFileName() ) ) {
319 QFileInfo finfo ( defaultFileName() ); 319 QFileInfo finfo ( defaultFileName() );
320 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 320 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
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 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";
322 finfo.setFile( oldFile ); 322 finfo.setFile( oldFile );
323 if (finfo.exists() ) { 323 if (finfo.exists() ) {
324 KMessageBox::information( this, message); 324 KMessageBox::information( this, message);
325 mView->openCalendar( oldFile ); 325 mView->openCalendar( oldFile );
326 qApp->processEvents(); 326 qApp->processEvents();
327 } else { 327 } else {
328 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 328 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
329 finfo.setFile( oldFile ); 329 finfo.setFile( oldFile );
330 if (finfo.exists() ) { 330 if (finfo.exists() ) {
331 KMessageBox::information( this, message); 331 KMessageBox::information( this, message);
332 mView->openCalendar( oldFile ); 332 mView->openCalendar( oldFile );
333 qApp->processEvents(); 333 qApp->processEvents();
334 } 334 }
335 } 335 }
336 mView->saveCalendar( defaultFileName() ); 336 mView->saveCalendar( defaultFileName() );
337 newFile = true; 337 newFile = true;
338 } 338 }
339 339
340 QTime neededSaveTime = QDateTime::currentDateTime().time(); 340 QTime neededSaveTime = QDateTime::currentDateTime().time();
341 mView->loadCalendars(); 341 mView->loadCalendars();
342 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 342 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
343 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 343 qDebug("KO: Calendar loading time: %d ms",msNeeded );
344 344
345 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 345 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
346 KOPrefs::instance()->setAllDefaults(); 346 KOPrefs::instance()->setAllDefaults();
347 int count = mView->addCategories(); 347 int count = mView->addCategories();
348 } 348 }
349 processIncidenceSelection( 0 ); 349 processIncidenceSelection( 0 );
350 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 350 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
351 SLOT( processIncidenceSelection( Incidence * ) ) ); 351 SLOT( processIncidenceSelection( Incidence * ) ) );
352 connect( mView, SIGNAL( modifiedChanged( bool ) ), 352 connect( mView, SIGNAL( modifiedChanged( bool ) ),
353 SLOT( slotModifiedChanged( bool ) ) ); 353 SLOT( slotModifiedChanged( bool ) ) );
354 354
355 355
356 connect( mView, SIGNAL( tempDisableBR(bool) ), 356 connect( mView, SIGNAL( tempDisableBR(bool) ),
357 SLOT( disableBR(bool) ) ); 357 SLOT( disableBR(bool) ) );
358 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 358 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
359 mView->setModified( false ); 359 mView->setModified( false );
360 mBlockAtStartup = false; 360 mBlockAtStartup = false;
361 mView->setModified( false ); 361 mView->setModified( false );
362 setCentralWidget( mView ); 362 setCentralWidget( mView );
363 globalFlagBlockStartup = 0; 363 globalFlagBlockStartup = 0;
364 mView->show(); 364 mView->show();
365 delete splash; 365 delete splash;
366 if ( newFile ) 366 if ( newFile )
367 mView->updateConfig(); 367 mView->updateConfig();
368 // qApp->processEvents(); 368 // qApp->processEvents();
369 //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 ());
370 //fillSyncMenu(); 370 //fillSyncMenu();
371 371
372 372
373 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 373 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
374 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 374 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
375 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 375 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
376 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 376 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
377 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 377 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
378 mSyncManager->setDefaultFileName( sentSyncFile()); 378 mSyncManager->setDefaultFileName( sentSyncFile());
379 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 379 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
380 mSyncManager->fillSyncMenu(); 380 mSyncManager->fillSyncMenu();
381 381
382 382
383 383
384 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 384 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
385 if ( showWarning ) { 385 if ( showWarning ) {
386 KMessageBox::information( this, 386 KMessageBox::information( this,
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 "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");
388 qApp->processEvents(); 388 qApp->processEvents();
389 mView->dialogManager()->showSyncOptions(); 389 mView->dialogManager()->showSyncOptions();
390 } 390 }
391 391
392 //US listen for result adressed from Ka/Pi 392 //US listen for result adressed from Ka/Pi
393#ifndef DESKTOP_VERSION 393#ifndef DESKTOP_VERSION
394 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 & )));
395#endif 395#endif
396#ifndef DESKTOP_VERSION 396#ifndef DESKTOP_VERSION
397 infrared = 0; 397 infrared = 0;
398#endif 398#endif
399 updateFilterToolbar(); 399 updateFilterToolbar();
400 updateWeek( mView->startDate() ); 400 updateWeek( mView->startDate() );
401 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 401 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
402 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 402 SLOT( updateWeekNum( const KCal::DateList & ) ) );
403 mBRdisabled = false; 403 mBRdisabled = false;
404 //toggleBeamReceive(); 404 //toggleBeamReceive();
405 int tiint= 3000; 405 int tiint= 3000;
406#ifndef DESKTOP_VERSION 406#ifndef DESKTOP_VERSION
407 tiint = 5000; 407 tiint = 5000;
408#endif 408#endif
409 QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() )); 409 QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() ));
410} 410}
411MainWindow::~MainWindow() 411MainWindow::~MainWindow()
412{ 412{
413 //qDebug("MainWindow::~MainWindow() "); 413 //qDebug("MainWindow::~MainWindow() ");
414 //save toolbar location 414 //save toolbar location
415 delete mCalendar; 415 delete mCalendar;
416 delete mSyncManager; 416 delete mSyncManager;
417#ifndef DESKTOP_VERSION 417#ifndef DESKTOP_VERSION
418 if ( infrared ) 418 if ( infrared )
419 delete infrared; 419 delete infrared;
420#endif 420#endif
421 421
422 422
423} 423}
424 424
425void MainWindow::disableBR(bool b) 425void MainWindow::disableBR(bool b)
426{ 426{
427#ifndef DESKTOP_VERSION 427#ifndef DESKTOP_VERSION
428 if ( b ) { 428 if ( b ) {
429 if ( infrared ) { 429 if ( infrared ) {
430 toggleBeamReceive(); 430 toggleBeamReceive();
431 mBRdisabled = true; 431 mBRdisabled = true;
432 } 432 }
433 mBRdisabled = true; 433 mBRdisabled = true;
434 } else { 434 } else {
435 if ( mBRdisabled ) { 435 if ( mBRdisabled ) {
436 mBRdisabled = false; 436 mBRdisabled = false;
437 //makes no sense,because other cal ap is probably running 437 //makes no sense,because other cal ap is probably running
438 // toggleBeamReceive(); 438 // toggleBeamReceive();
439 } 439 }
440 } 440 }
441#endif 441#endif
442 442
443} 443}
444bool MainWindow::beamReceiveEnabled() 444bool MainWindow::beamReceiveEnabled()
445{ 445{
446#ifndef DESKTOP_VERSION 446#ifndef DESKTOP_VERSION
447 return ( infrared != 0 ); 447 return ( infrared != 0 );
448#endif 448#endif
449 return false; 449 return false;
450} 450}
451 451
452void MainWindow::toggleBeamReceive() 452void MainWindow::toggleBeamReceive()
453{ 453{
454 if ( mBRdisabled ) 454 if ( mBRdisabled )
455 return; 455 return;
456#ifndef DESKTOP_VERSION 456#ifndef DESKTOP_VERSION
457 if ( infrared ) { 457 if ( infrared ) {
458 qDebug("KO: Disable BeamReceive "); 458 qDebug("KO: Disable BeamReceive ");
459 delete infrared; 459 delete infrared;
460 infrared = 0; 460 infrared = 0;
461 brAction->setOn(false); 461 brAction->setOn(false);
462 return; 462 return;
463 } 463 }
464 qDebug("KO: Enable BeamReceive "); 464 qDebug("KO: Enable BeamReceive ");
465 brAction->setOn(true); 465 brAction->setOn(true);
466 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 466 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
467 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& )));
468#endif 468#endif
469} 469}
470void MainWindow::showMaximized () 470void MainWindow::showMaximized ()
471{ 471{
472#ifndef DESKTOP_VERSION 472#ifndef DESKTOP_VERSION
473 if ( ! globalFlagBlockStartup ) 473 if ( ! globalFlagBlockStartup )
474 if ( mClosed ) 474 if ( mClosed )
475 mView->goToday(); 475 mView->goToday();
476#endif 476#endif
477 QWidget::showMaximized () ; 477 QWidget::showMaximized () ;
478 mClosed = false; 478 mClosed = false;
479} 479}
480void MainWindow::closeEvent( QCloseEvent* ce ) 480void MainWindow::closeEvent( QCloseEvent* ce )
481{ 481{
482 482
483 483
484 484
485 if ( ! KOPrefs::instance()->mAskForQuit ) { 485 if ( ! KOPrefs::instance()->mAskForQuit ) {
486 saveOnClose(); 486 saveOnClose();
487 mClosed = true; 487 mClosed = true;
488 ce->accept(); 488 ce->accept();
489 return; 489 return;
490 490
491 } 491 }
492 492
493 switch( QMessageBox::information( this, "KO/Pi", 493 switch( QMessageBox::information( this, "KO/Pi",
494 i18n("Do you really want\nto close KO/Pi?"), 494 i18n("Do you really want\nto close KO/Pi?"),
495 i18n("Close"), i18n("No"), 495 i18n("Close"), i18n("No"),
496 0, 0 ) ) { 496 0, 0 ) ) {
497 case 0: 497 case 0:
498 saveOnClose(); 498 saveOnClose();
499 mClosed = true; 499 mClosed = true;
500 ce->accept(); 500 ce->accept();
501 break; 501 break;
502 case 1: 502 case 1:
503 ce->ignore(); 503 ce->ignore();
504 break; 504 break;
505 case 2: 505 case 2:
506 506
507 default: 507 default:
508 break; 508 break;
509 } 509 }
510 510
511 511
512} 512}
513 513
514void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 514void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
515{ 515{
516 QDataStream stream( data, IO_ReadOnly ); 516 QDataStream stream( data, IO_ReadOnly );
517 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 517 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
518 //QString datamess; 518 //QString datamess;
519 //qDebug("message "); 519 //qDebug("message ");
520 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 520 qDebug("KO: QCOP message received: %s ", cmsg.data() );
521 521
522 if ( cmsg == "setDocument(QString)" ) { 522 if ( cmsg == "setDocument(QString)" ) {
523 QDataStream stream( data, IO_ReadOnly ); 523 QDataStream stream( data, IO_ReadOnly );
524 QString fileName; 524 QString fileName;
525 stream >> fileName; 525 stream >> fileName;
526 //qDebug("filename %s ", fileName.latin1()); 526 //qDebug("filename %s ", fileName.latin1());
527 showMaximized(); 527 showMaximized();
528 raise(); 528 raise();
529 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 529 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
530 mSyncManager->slotSyncMenu( 1002 ); 530 mSyncManager->slotSyncMenu( 1002 );
531 return; 531 return;
532 } 532 }
533 533
534 if ( cmsg == "-writeFile" ) { 534 if ( cmsg == "-writeFile" ) {
535 // I made from the "-writeFile" an "-writeAlarm" 535 // I made from the "-writeFile" an "-writeAlarm"
536 mView->viewManager()->showWhatsNextView(); 536 mView->viewManager()->showWhatsNextView();
537 mCalendar->checkAlarmForIncidence( 0, true); 537 mCalendar->checkAlarmForIncidence( 0, true);
538 showMaximized(); 538 showMaximized();
539 raise(); 539 raise();
540 return; 540 return;
541 541
542 } 542 }
543 if ( cmsg == "-writeFileSilent" ) { 543 if ( cmsg == "-writeFileSilent" ) {
544 // I made from the "-writeFile" an "-writeAlarm" 544 // I made from the "-writeFile" an "-writeAlarm"
545 // mView->viewManager()->showWhatsNextView(); 545 // mView->viewManager()->showWhatsNextView();
546 mCalendar->checkAlarmForIncidence( 0, true); 546 mCalendar->checkAlarmForIncidence( 0, true);
547 //showMaximized(); 547 //showMaximized();
548 //raise(); 548 //raise();
549 hide(); 549 hide();
550 return; 550 return;
551 } 551 }
552 if ( cmsg == "-newCountdown" ) { 552 if ( cmsg == "-newCountdown" ) {
553 qDebug("newCountdown "); 553 qDebug("newCountdown ");
554 554
555 } 555 }
556 QString msg ; 556 QString msg ;
557 QString allmsg = cmsg; 557 QString allmsg = cmsg;
558 while ( allmsg.length() > 0 ) { 558 while ( allmsg.length() > 0 ) {
559 int nextC = allmsg.find( "-", 1 ); 559 int nextC = allmsg.find( "-", 1 );
560 if ( nextC == -1 ) { 560 if ( nextC == -1 ) {
561 msg = allmsg; 561 msg = allmsg;
562 allmsg = ""; 562 allmsg = "";
563 } else{ 563 } else{
564 msg = allmsg.left( nextC ); 564 msg = allmsg.left( nextC );
565 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 565 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
566 } 566 }
567 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 567 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
568 if ( msg == "-newEvent" ) { 568 if ( msg == "-newEvent" ) {
569 QTimer::singleShot( 0, mView, SLOT ( newEvent())); 569 QTimer::singleShot( 0, mView, SLOT ( newEvent()));
570 } 570 }
571 if ( msg == "-newTodo" ) { 571 if ( msg == "-newTodo" ) {
572 QTimer::singleShot( 0, mView, SLOT ( newTodo())); 572 QTimer::singleShot( 0, mView, SLOT ( newTodo()));
573 } 573 }
574 if ( msg == "-showWN" ) { 574 if ( msg == "-showWN" ) {
575 mView->viewManager()->showWhatsNextView(); 575 mView->viewManager()->showWhatsNextView();
576 } 576 }
577 if ( msg == "-showTodo" ) { 577 if ( msg == "-showTodo" ) {
578 mView->viewManager()->showTodoView(); 578 mView->viewManager()->showTodoView();
579 } 579 }
580 if ( msg == "-showList" ) { 580 if ( msg == "-showList" ) {
581 mView->viewManager()->showListView(); 581 mView->viewManager()->showListView();
582 } 582 }
583 else if ( msg == "-showDay" ) { 583 else if ( msg == "-showDay" ) {
584 mView->viewManager()->showDayView(); 584 mView->viewManager()->showDayView();
585 } 585 }
586 else if ( msg == "-showWWeek" ) { 586 else if ( msg == "-showWWeek" ) {
587 mView->viewManager()->showWorkWeekView(); 587 mView->viewManager()->showWorkWeekView();
588 } 588 }
589 else if ( msg == "-ringSync" ) { 589 else if ( msg == "-ringSync" ) {
590 QTimer::singleShot( 0, this, SLOT (startMultiSync())); 590 QTimer::singleShot( 0, this, SLOT (startMultiSync()));
591 } 591 }
592 else if ( msg == "-showWeek" ) { 592 else if ( msg == "-showWeek" ) {
593 mView->viewManager()->showWeekView(); 593 mView->viewManager()->showWeekView();
594 } 594 }
595 else if ( msg == "-showTodo" ) { 595 else if ( msg == "-showTodo" ) {
596 mView->viewManager()->showTodoView(); 596 mView->viewManager()->showTodoView();
597 } 597 }
598 else if ( msg == "-showJournal" ) { 598 else if ( msg == "-showJournal" ) {
599 mView->dateNavigator()->selectDates( 1 ); 599 mView->dateNavigator()->selectDates( 1 );
600 mView->dateNavigator()->selectToday(); 600 mView->dateNavigator()->selectToday();
601 mView->viewManager()->showJournalView(); 601 mView->viewManager()->showJournalView();
602 } 602 }
603 else if ( msg == "-showKO" ) { 603 else if ( msg == "-showKO" ) {
604 mView->viewManager()->showNextXView(); 604 mView->viewManager()->showNextXView();
605 } 605 }
606 else if ( msg == "-showWNext" ) { 606 else if ( msg == "-showWNext" ) {
607 mView->viewManager()->showWhatsNextView(); 607 mView->viewManager()->showWhatsNextView();
608 } 608 }
609 else if ( msg == "nextView()" ) { 609 else if ( msg == "nextView()" ) {
610 mView->viewManager()->showNextView(); 610 mView->viewManager()->showNextView();
611 } 611 }
612 else if ( msg == "-showNextXView" ) { 612 else if ( msg == "-showNextXView" ) {
613 mView->viewManager()->showNextXView(); 613 mView->viewManager()->showNextXView();
614 } 614 }
615 615
616 616
617 } 617 }
618 618
619 showMaximized(); 619 showMaximized();
620 raise(); 620 raise();
621} 621}
622void MainWindow::startMultiSync() 622void MainWindow::startMultiSync()
623{ 623{
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 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
625 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), 625 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
626 question, 626 question,
627 i18n("Yes"), i18n("No"), 627 i18n("Yes"), i18n("No"),
628 0, 0 ) != 0 ) { 628 0, 0 ) != 0 ) {
629 setCaption(i18n("Aborted! Nothing synced!")); 629 setCaption(i18n("Aborted! Nothing synced!"));
630 return; 630 return;
631 } 631 }
632 mSyncManager->multiSync( false ); 632 mSyncManager->multiSync( false );
633#ifndef DESKTOP_VERSION 633#ifndef DESKTOP_VERSION
634 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 634 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
635#endif 635#endif
636} 636}
637QPixmap MainWindow::loadPixmap( QString name ) 637QPixmap MainWindow::loadPixmap( QString name )
638{ 638{
639 return SmallIcon( name ); 639 return SmallIcon( name );
640 640
641} 641}
642void MainWindow::setUsesBigPixmaps ( bool b ) 642void MainWindow::setUsesBigPixmaps ( bool b )
643{ 643{
644 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 644 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
645 if ( b ) 645 if ( b )
646 qDebug("KO: BigPixmaps are not supported "); 646 qDebug("KO: BigPixmaps are not supported ");
647} 647}
648void MainWindow::initActions() 648void MainWindow::initActions()
649{ 649{
650 //KOPrefs::instance()->mShowFullMenu 650 //KOPrefs::instance()->mShowFullMenu
651 iconToolBar->clear(); 651 iconToolBar->clear();
652 KOPrefs *p = KOPrefs::instance(); 652 KOPrefs *p = KOPrefs::instance();
653 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 653 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
654 654
655 QPopupMenu *viewMenu = new QPopupMenu( this ); 655 QPopupMenu *viewMenu = new QPopupMenu( this );
656 QPopupMenu *actionMenu = new QPopupMenu( this ); 656 QPopupMenu *actionMenu = new QPopupMenu( this );
657 QPopupMenu *importMenu = new QPopupMenu( this ); 657 QPopupMenu *importMenu = new QPopupMenu( this );
658 QPopupMenu *importMenu_X = new QPopupMenu( this ); 658 QPopupMenu *importMenu_X = new QPopupMenu( this );
659 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 659 QPopupMenu *exportMenu_X = new QPopupMenu( this );
660 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 660 QPopupMenu *beamMenu_X = new QPopupMenu( this );
661 selectFilterMenu = new QPopupMenu( this ); 661 selectFilterMenu = new QPopupMenu( this );
662 selectFilterMenu->setCheckable( true ); 662 selectFilterMenu->setCheckable( true );
663 syncMenu = new QPopupMenu( this ); 663 syncMenu = new QPopupMenu( this );
664 configureAgendaMenu = new QPopupMenu( this ); 664 configureAgendaMenu = new QPopupMenu( this );
665 configureToolBarMenu = new QPopupMenu( this ); 665 configureToolBarMenu = new QPopupMenu( this );
666 QPopupMenu *helpMenu = new QPopupMenu( this ); 666 QPopupMenu *helpMenu = new QPopupMenu( this );
667 QIconSet icon; 667 QIconSet icon;
668 int pixWid = 22, pixHei = 22; 668 int pixWid = 22, pixHei = 22;
669 QString pathString = ""; 669 QString pathString = "";
670 if ( !p->mToolBarMiniIcons ) { 670 if ( !p->mToolBarMiniIcons ) {
671 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 671 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
672 pathString += "icons16/"; 672 pathString += "icons16/";
673 pixWid = 18; pixHei = 16; 673 pixWid = 18; pixHei = 16;
674 } 674 }
675 } else { 675 } else {
676 pathString += "iconsmini/"; 676 pathString += "iconsmini/";
677 pixWid = 18; pixHei = 16; 677 pixWid = 18; pixHei = 16;
678 } 678 }
679 if ( KOPrefs::instance()->mShowFullMenu ) { 679 if ( KOPrefs::instance()->mShowFullMenu ) {
680 QMenuBar *menuBar1; 680 QMenuBar *menuBar1;
681 menuBar1 = menuBar(); 681 menuBar1 = menuBar();
682 menuBar1->insertItem( i18n("File"), importMenu ); 682 menuBar1->insertItem( i18n("File"), importMenu );
683 menuBar1->insertItem( i18n("View"), viewMenu ); 683 menuBar1->insertItem( i18n("View"), viewMenu );
684 menuBar1->insertItem( i18n("Actions"), actionMenu ); 684 menuBar1->insertItem( i18n("Actions"), actionMenu );
685#ifdef DESKTOP_VERSION 685#ifdef DESKTOP_VERSION
686 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 686 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
687 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 687 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
688#else 688#else
689 menuBar1->insertItem( i18n("Sync"), syncMenu ); 689 menuBar1->insertItem( i18n("Sync"), syncMenu );
690 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 690 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
691#endif 691#endif
692 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 692 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
693 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 693 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
694 menuBar1->insertItem( i18n("Help"), helpMenu ); 694 menuBar1->insertItem( i18n("Help"), helpMenu );
695 } else { 695 } else {
696 QPEMenuBar *menuBar1; 696 QPEMenuBar *menuBar1;
697 menuBar1 = new QPEMenuBar( iconToolBar ); 697 menuBar1 = new QPEMenuBar( iconToolBar );
698 QPopupMenu *menuBar = new QPopupMenu( this ); 698 QPopupMenu *menuBar = new QPopupMenu( this );
699 icon = loadPixmap( pathString + "z_menu" ); 699 icon = loadPixmap( pathString + "z_menu" );
700 menuBar1->insertItem( icon.pixmap(), menuBar); 700 menuBar1->insertItem( icon.pixmap(), menuBar);
701 //menuBar1->insertItem( i18n("ME"), menuBar); 701 //menuBar1->insertItem( i18n("ME"), menuBar);
702 menuBar->insertItem( i18n("File"), importMenu ); 702 menuBar->insertItem( i18n("File"), importMenu );
703 menuBar->insertItem( i18n("View"), viewMenu ); 703 menuBar->insertItem( i18n("View"), viewMenu );
704 menuBar->insertItem( i18n("Actions"), actionMenu ); 704 menuBar->insertItem( i18n("Actions"), actionMenu );
705 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 705 menuBar->insertItem( i18n("Synchronize"), syncMenu );
706 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 706 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
707 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 707 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
708 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 708 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
709 menuBar->insertItem( i18n("Help"), helpMenu ); 709 menuBar->insertItem( i18n("Help"), helpMenu );
710 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 710 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
711 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 711 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
712 } 712 }
713 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 713 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
714 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 714 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
715 715
716 716
717 mWeekBgColor = iconToolBar->backgroundColor(); 717 mWeekBgColor = iconToolBar->backgroundColor();
718 mWeekPixmap.resize( pixWid , pixHei ); 718 mWeekPixmap.resize( pixWid , pixHei );
719 mWeekPixmap.fill( mWeekBgColor ); 719 mWeekPixmap.fill( mWeekBgColor );
720 icon = mWeekPixmap; 720 icon = mWeekPixmap;
721 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 );
722 if ( p-> mShowIconWeekNum ) 722 if ( p-> mShowIconWeekNum )
723 mWeekAction->addTo( iconToolBar ); 723 mWeekAction->addTo( iconToolBar );
724 mWeekFont = font(); 724 mWeekFont = font();
725 725
726 int fontPoint = mWeekFont.pointSize(); 726 int fontPoint = mWeekFont.pointSize();
727 QFontMetrics f( mWeekFont ); 727 QFontMetrics f( mWeekFont );
728 int fontWid = f.width( "30" ); 728 int fontWid = f.width( "30" );
729 while ( fontWid > pixWid ) { 729 while ( fontWid > pixWid ) {
730 --fontPoint; 730 --fontPoint;
731 mWeekFont.setPointSize( fontPoint ); 731 mWeekFont.setPointSize( fontPoint );
732 QFontMetrics f( mWeekFont ); 732 QFontMetrics f( mWeekFont );
733 fontWid = f.width( "30" ); 733 fontWid = f.width( "30" );
734 //qDebug("dec-- "); 734 //qDebug("dec-- ");
735 } 735 }
736 736
737 connect( mWeekAction, SIGNAL( activated() ), 737 connect( mWeekAction, SIGNAL( activated() ),
738 this, SLOT( weekAction() ) ); 738 this, SLOT( weekAction() ) );
739 739
740 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 740 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
741 if ( p->mShowIconFilterview ) { 741 if ( p->mShowIconFilterview ) {
742 icon = loadPixmap( pathString + "filter" ); 742 icon = loadPixmap( pathString + "filter" );
743 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 );
744 connect( actionFilterMenuTB, SIGNAL( activated() ), 744 connect( actionFilterMenuTB, SIGNAL( activated() ),
745 this, SLOT( fillFilterMenuTB() ) ); 745 this, SLOT( fillFilterMenuTB() ) );
746 actionFilterMenuTB->addTo( iconToolBar ); 746 actionFilterMenuTB->addTo( iconToolBar );
747 selectFilterMenuTB = new QPopupMenu( this ); 747 selectFilterMenuTB = new QPopupMenu( this );
748 selectFilterMenuTB->setCheckable( true ); 748 selectFilterMenuTB->setCheckable( true );
749 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 749 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
750 } 750 }
751 751
752 //#endif 752 //#endif
753 // ****************** 753 // ******************
754 QAction *action; 754 QAction *action;
755 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 755 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
756 configureToolBarMenu->setCheckable( true ); 756 configureToolBarMenu->setCheckable( true );
757 757
758 758
759 configureAgendaMenu->setCheckable( true ); 759 configureAgendaMenu->setCheckable( true );
760 int iii ; 760 int iii ;
761 for ( iii = 1;iii<= 10 ;++iii ){ 761 for ( iii = 1;iii<= 10 ;++iii ){
762 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 762 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
763 } 763 }
764 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 764 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
765 765
766 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 766 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
767 this, SLOT( showConfigureAgenda( ) ) ); 767 this, SLOT( showConfigureAgenda( ) ) );
768 768
769 icon = loadPixmap( pathString + "configure" ); 769 icon = loadPixmap( pathString + "configure" );
770 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 );
771 action->addTo( actionMenu ); 771 action->addTo( actionMenu );
772 connect( action, SIGNAL( activated() ), 772 connect( action, SIGNAL( activated() ),
773 mView, SLOT( edit_options() ) ); 773 mView, SLOT( edit_options() ) );
774 icon = loadPixmap( pathString + "configure" ); 774 icon = loadPixmap( pathString + "configure" );
775 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 775 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
776 action->addTo( actionMenu ); 776 action->addTo( actionMenu );
777 connect( action, SIGNAL( activated() ), 777 connect( action, SIGNAL( activated() ),
778 mView, SLOT( edit_global_options() ) ); 778 mView, SLOT( edit_global_options() ) );
779 actionMenu->insertSeparator(); 779 actionMenu->insertSeparator();
780 780
781 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 781 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
782 action->addTo( actionMenu ); 782 action->addTo( actionMenu );
783 connect( action, SIGNAL( activated() ), 783 connect( action, SIGNAL( activated() ),
784 mView, SLOT( undo_delete() ) ); 784 mView, SLOT( undo_delete() ) );
785 actionMenu->insertSeparator(); 785 actionMenu->insertSeparator();
786 786
787 icon = loadPixmap( pathString + "newevent" ); 787 icon = loadPixmap( pathString + "newevent" );
788 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 788 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
789 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 789 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
790 configureToolBarMenu->insertSeparator(); 790 configureToolBarMenu->insertSeparator();
791 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 791 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
792 configureToolBarMenu->insertSeparator(); 792 configureToolBarMenu->insertSeparator();
793 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 793 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
794 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 794 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
795 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 );
796 ne_action->addTo( actionMenu ); 796 ne_action->addTo( actionMenu );
797 connect( ne_action, SIGNAL( activated() ), 797 connect( ne_action, SIGNAL( activated() ),
798 mView, SLOT( newEvent() ) ); 798 mView, SLOT( newEvent() ) );
799 icon = loadPixmap( pathString + "newtodo" ); 799 icon = loadPixmap( pathString + "newtodo" );
800 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 800 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
801 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 );
802 nt_action->addTo( actionMenu ); 802 nt_action->addTo( actionMenu );
803 connect( nt_action, SIGNAL( activated() ), 803 connect( nt_action, SIGNAL( activated() ),
804 mView, SLOT( newTodo() ) ); 804 mView, SLOT( newTodo() ) );
805 805
806 icon = loadPixmap( pathString + "today" ); 806 icon = loadPixmap( pathString + "today" );
807 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 );
808 today_action->addTo( viewMenu ); 808 today_action->addTo( viewMenu );
809 connect( today_action, SIGNAL( activated() ), 809 connect( today_action, SIGNAL( activated() ),
810 mView, SLOT( goToday() ) ); 810 mView, SLOT( goToday() ) );
811 viewMenu->insertSeparator(); 811 viewMenu->insertSeparator();
812 812
813 // *********************** 813 // ***********************
814 if ( KOPrefs::instance()->mVerticalScreen ) { 814 if ( KOPrefs::instance()->mVerticalScreen ) {
815 icon = SmallIcon( "1updownarrow" ); 815 icon = SmallIcon( "1updownarrow" );
816 } else { 816 } else {
817 icon = SmallIcon("1leftrightarrow" ); 817 icon = SmallIcon("1leftrightarrow" );
818 } 818 }
819 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 819 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
820 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 );
821 FSaction->addTo( viewMenu ); 821 FSaction->addTo( viewMenu );
822 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 822 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
823 823
824 824
825 icon = loadPixmap( pathString + "filter" ); 825 icon = loadPixmap( pathString + "filter" );
826 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 826 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
827 icon = loadPixmap( pathString + "configure" ); 827 icon = loadPixmap( pathString + "configure" );
828 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 );
829 action->addTo( viewMenu ); 829 action->addTo( viewMenu );
830 connect( action, SIGNAL( activated() ), 830 connect( action, SIGNAL( activated() ),
831 mView, SLOT( toggleFilter() ) ); 831 mView, SLOT( toggleFilter() ) );
832 mToggleFilter = action; 832 mToggleFilter = action;
833 icon = loadPixmap( pathString + "navi" ); 833 icon = loadPixmap( pathString + "navi" );
834 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 834 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
835 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 );
836 action->addTo( viewMenu ); 836 action->addTo( viewMenu );
837 connect( action, SIGNAL( activated() ), 837 connect( action, SIGNAL( activated() ),
838 mView, SLOT( toggleDateNavigatorWidget() ) ); 838 mView, SLOT( toggleDateNavigatorWidget() ) );
839 mToggleNav = action ; 839 mToggleNav = action ;
840 icon = loadPixmap( pathString + "allday" ); 840 icon = loadPixmap( pathString + "allday" );
841 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 841 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
842 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 );
843 action->addTo( viewMenu ); 843 action->addTo( viewMenu );
844 connect( action, SIGNAL( activated() ), 844 connect( action, SIGNAL( activated() ),
845 mView, SLOT( toggleAllDaySize() ) ); 845 mView, SLOT( toggleAllDaySize() ) );
846 mToggleAllday = action; 846 mToggleAllday = action;
847 847
848 848
849 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 849 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
850 mToggleNav, SLOT( setEnabled ( bool ) ) ); 850 mToggleNav, SLOT( setEnabled ( bool ) ) );
851 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 851 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
852 // mToggleFilter, SLOT( setEnabled ( bool ) ) ); 852 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
853 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 853 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
854 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 854 mToggleAllday, SLOT( setEnabled ( bool ) ) );
855 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 855 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
856 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 856 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
857 857
858 viewMenu->insertSeparator(); 858 viewMenu->insertSeparator();
859 icon = loadPixmap( pathString + "picker" ); 859 icon = loadPixmap( pathString + "picker" );
860 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 );
861 action->addTo( viewMenu ); 861 action->addTo( viewMenu );
862 connect( action, SIGNAL( activated() ), 862 connect( action, SIGNAL( activated() ),
863 mView, SLOT( showDatePicker() ) ); 863 mView, SLOT( showDatePicker() ) );
864 action->addTo( iconToolBar ); 864 action->addTo( iconToolBar );
865 viewMenu->insertSeparator(); 865 viewMenu->insertSeparator();
866 866
867 if ( p-> mShowIconToggleFull ) 867 if ( p-> mShowIconToggleFull )
868 FSaction->addTo( iconToolBar ); 868 FSaction->addTo( iconToolBar );
869 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 869 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
870 870
871 //******************** 871 //********************
872 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 872 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
873 873
874 874
875 icon = loadPixmap( pathString + "whatsnext" ); 875 icon = loadPixmap( pathString + "whatsnext" );
876 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 876 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
877 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 );
878 whatsnext_action->addTo( viewMenu ); 878 whatsnext_action->addTo( viewMenu );
879 connect( whatsnext_action, SIGNAL( activated() ), 879 connect( whatsnext_action, SIGNAL( activated() ),
880 mView->viewManager(), SLOT( showWhatsNextView() ) ); 880 mView->viewManager(), SLOT( showWhatsNextView() ) );
881 881
882 icon = loadPixmap( pathString + "xdays" ); 882 icon = loadPixmap( pathString + "xdays" );
883 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 883 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
884 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 );
885 xdays_action->addTo( viewMenu ); 885 xdays_action->addTo( viewMenu );
886 connect( xdays_action, SIGNAL( activated() ), 886 connect( xdays_action, SIGNAL( activated() ),
887 mView->viewManager(), SLOT( showNextXView() ) ); 887 mView->viewManager(), SLOT( showNextXView() ) );
888 888
889 889
890 icon = loadPixmap( pathString + "journal" ); 890 icon = loadPixmap( pathString + "journal" );
891 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 891 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
892 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 );
893 viewjournal_action->addTo( viewMenu ); 893 viewjournal_action->addTo( viewMenu );
894 connect( viewjournal_action, SIGNAL( activated() ), 894 connect( viewjournal_action, SIGNAL( activated() ),
895 mView->viewManager(), SLOT( showJournalView() ) ); 895 mView->viewManager(), SLOT( showJournalView() ) );
896 896
897 897
898 icon = loadPixmap( pathString + "day" ); 898 icon = loadPixmap( pathString + "day" );
899 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 899 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
900 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 );
901 day1_action->addTo( viewMenu ); 901 day1_action->addTo( viewMenu );
902 // action->addTo( toolBar ); 902 // action->addTo( toolBar );
903 connect( day1_action, SIGNAL( activated() ), 903 connect( day1_action, SIGNAL( activated() ),
904 mView->viewManager(), SLOT( showDayView() ) ); 904 mView->viewManager(), SLOT( showDayView() ) );
905 905
906 icon = loadPixmap( pathString + "workweek" ); 906 icon = loadPixmap( pathString + "workweek" );
907 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 907 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
908 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 );
909 day5_action->addTo( viewMenu ); 909 day5_action->addTo( viewMenu );
910 connect( day5_action, SIGNAL( activated() ), 910 connect( day5_action, SIGNAL( activated() ),
911 mView->viewManager(), SLOT( showWorkWeekView() ) ); 911 mView->viewManager(), SLOT( showWorkWeekView() ) );
912 912
913 icon = loadPixmap( pathString + "week" ); 913 icon = loadPixmap( pathString + "week" );
914 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 914 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
915 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 );
916 day7_action->addTo( viewMenu ); 916 day7_action->addTo( viewMenu );
917 connect( day7_action, SIGNAL( activated() ), 917 connect( day7_action, SIGNAL( activated() ),
918 mView->viewManager(), SLOT( showWeekView() ) ); 918 mView->viewManager(), SLOT( showWeekView() ) );
919 919
920 icon = loadPixmap( pathString + "workweek2" ); 920 icon = loadPixmap( pathString + "workweek2" );
921 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 921 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
922 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 );
923 day6_action->addTo( viewMenu ); 923 day6_action->addTo( viewMenu );
924 connect( day6_action, SIGNAL( activated() ), 924 connect( day6_action, SIGNAL( activated() ),
925 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 925 mView->viewManager(), SLOT( showMonthViewWeek() ) );
926 926
927 icon = loadPixmap( pathString + "month" ); 927 icon = loadPixmap( pathString + "month" );
928 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 928 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
929 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 );
930 month_action->addTo( viewMenu ); 930 month_action->addTo( viewMenu );
931 connect( month_action, SIGNAL( activated() ), 931 connect( month_action, SIGNAL( activated() ),
932 mView->viewManager(), SLOT( showMonthView() ) ); 932 mView->viewManager(), SLOT( showMonthView() ) );
933 933
934 icon = loadPixmap( pathString + "list" ); 934 icon = loadPixmap( pathString + "list" );
935 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 935 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
936 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 );
937 showlist_action->addTo( viewMenu ); 937 showlist_action->addTo( viewMenu );
938 connect( showlist_action, SIGNAL( activated() ), 938 connect( showlist_action, SIGNAL( activated() ),
939 mView->viewManager(), SLOT( showListView() ) ); 939 mView->viewManager(), SLOT( showListView() ) );
940 940
941 icon = loadPixmap( pathString + "todo" ); 941 icon = loadPixmap( pathString + "todo" );
942 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 942 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
943 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 );
944 todoview_action->addTo( viewMenu ); 944 todoview_action->addTo( viewMenu );
945 connect( todoview_action, SIGNAL( activated() ), 945 connect( todoview_action, SIGNAL( activated() ),
946 mView->viewManager(), SLOT( showTodoView() ) ); 946 mView->viewManager(), SLOT( showTodoView() ) );
947 947
948 948
949 949
950#if 0 950#if 0
951 action = new QAction( "view_timespan", "Time Span", 0, this ); 951 action = new QAction( "view_timespan", "Time Span", 0, this );
952 action->addTo( viewMenu ); 952 action->addTo( viewMenu );
953 connect( action, SIGNAL( activated() ), 953 connect( action, SIGNAL( activated() ),
954 mView->viewManager(), SLOT( showTimeSpanView() ) ); 954 mView->viewManager(), SLOT( showTimeSpanView() ) );
955#endif 955#endif
956 956
957 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 957 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
958 this ); 958 this );
959 mNewSubTodoAction->addTo( actionMenu ); 959 mNewSubTodoAction->addTo( actionMenu );
960 connect( mNewSubTodoAction, SIGNAL( activated() ), 960 connect( mNewSubTodoAction, SIGNAL( activated() ),
961 mView, SLOT( newSubTodo() ) ); 961 mView, SLOT( newSubTodo() ) );
962 962
963 actionMenu->insertSeparator(); 963 actionMenu->insertSeparator();
964 964
965 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 965 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
966 mShowAction->addTo( actionMenu ); 966 mShowAction->addTo( actionMenu );
967 connect( mShowAction, SIGNAL( activated() ), 967 connect( mShowAction, SIGNAL( activated() ),
968 mView, SLOT( showIncidence() ) ); 968 mView, SLOT( showIncidence() ) );
969 969
970 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 970 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
971 mEditAction->addTo( actionMenu ); 971 mEditAction->addTo( actionMenu );
972 connect( mEditAction, SIGNAL( activated() ), 972 connect( mEditAction, SIGNAL( activated() ),
973 mView, SLOT( editIncidence() ) ); 973 mView, SLOT( editIncidence() ) );
974 974
975 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 975 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
976 mDeleteAction->addTo( actionMenu ); 976 mDeleteAction->addTo( actionMenu );
977 connect( mDeleteAction, SIGNAL( activated() ), 977 connect( mDeleteAction, SIGNAL( activated() ),
978 mView, SLOT( deleteIncidence() ) ); 978 mView, SLOT( deleteIncidence() ) );
979 979
980 980
981 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 981 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
982 mCloneAction->addTo( actionMenu ); 982 mCloneAction->addTo( actionMenu );
983 connect( mCloneAction, SIGNAL( activated() ), 983 connect( mCloneAction, SIGNAL( activated() ),
984 mView, SLOT( cloneIncidence() ) ); 984 mView, SLOT( cloneIncidence() ) );
985 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 985 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
986 mMoveAction->addTo( actionMenu ); 986 mMoveAction->addTo( actionMenu );
987 connect( mMoveAction, SIGNAL( activated() ), 987 connect( mMoveAction, SIGNAL( activated() ),
988 mView, SLOT( moveIncidence() ) ); 988 mView, SLOT( moveIncidence() ) );
989 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 989 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
990 mBeamAction->addTo( actionMenu ); 990 mBeamAction->addTo( actionMenu );
991 connect( mBeamAction, SIGNAL( activated() ), 991 connect( mBeamAction, SIGNAL( activated() ),
992 mView, SLOT( beamIncidence() ) ); 992 mView, SLOT( beamIncidence() ) );
993 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 993 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
994 mCancelAction->addTo( actionMenu ); 994 mCancelAction->addTo( actionMenu );
995 connect( mCancelAction, SIGNAL( activated() ), 995 connect( mCancelAction, SIGNAL( activated() ),
996 mView, SLOT( toggleCancelIncidence() ) ); 996 mView, SLOT( toggleCancelIncidence() ) );
997 997
998 actionMenu->insertSeparator(); 998 actionMenu->insertSeparator();
999 999
1000 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 1000 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
1001 this ); 1001 this );
1002 action->addTo( actionMenu ); 1002 action->addTo( actionMenu );
1003 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 1003 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
1004 1004
1005 icon = loadPixmap( pathString + "search" ); 1005 icon = loadPixmap( pathString + "search" );
1006 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 );
1007 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 1007 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
1008 search_action->addTo( actionMenu ); 1008 search_action->addTo( actionMenu );
1009 connect( search_action, SIGNAL( activated() ), 1009 connect( search_action, SIGNAL( activated() ),
1010 mView->dialogManager(), SLOT( showSearchDialog() ) ); 1010 mView->dialogManager(), SLOT( showSearchDialog() ) );
1011 1011
1012 1012
1013 1013
1014 if ( KOPrefs::instance()->mShowFullMenu ) { 1014 if ( KOPrefs::instance()->mShowFullMenu ) {
1015 actionMenu->insertSeparator(); 1015 actionMenu->insertSeparator();
1016 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 1016 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
1017 1017
1018 } 1018 }
1019 // actionMenu->insertSeparator(); 1019 // actionMenu->insertSeparator();
1020 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 1020 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
1021 this ); 1021 this );
1022 action->addTo( importMenu_X ); 1022 action->addTo( importMenu_X );
1023 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 1023 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
1024 action = new QAction( "import_quick", i18n("Import last file"), 0, 1024 action = new QAction( "import_quick", i18n("Import last file"), 0,
1025 this ); 1025 this );
1026 action->addTo( importMenu_X ); 1026 action->addTo( importMenu_X );
1027 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 1027 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
1028 importMenu_X->insertSeparator(); 1028 importMenu_X->insertSeparator();
1029 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 1029 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
1030 this ); 1030 this );
1031 action->addTo( importMenu_X ); 1031 action->addTo( importMenu_X );
1032 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 1032 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
1033 //#ifndef DESKTOP_VERSION 1033 //#ifndef DESKTOP_VERSION
1034 importMenu_X->insertSeparator(); 1034 importMenu_X->insertSeparator();
1035 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 1035 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
1036 this ); 1036 this );
1037 action->addTo( importMenu_X ); 1037 action->addTo( importMenu_X );
1038 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 1038 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
1039 //#else 1039 //#else
1040#ifdef _OL_IMPORT_ 1040#ifdef _OL_IMPORT_
1041 importMenu_X->insertSeparator(); 1041 importMenu_X->insertSeparator();
1042 action = new QAction( "import_ol", i18n("Import from OL"), 0, 1042 action = new QAction( "import_ol", i18n("Import from OL"), 0,
1043 this ); 1043 this );
1044 action->addTo( importMenu_X ); 1044 action->addTo( importMenu_X );
1045 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1045 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1046#endif 1046#endif
1047 //#endif 1047 //#endif
1048 1048
1049 //importMenu->insertSeparator(); 1049 //importMenu->insertSeparator();
1050#if 0 1050#if 0
1051 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1051 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
1052 this ); 1052 this );
1053 action->addTo( importMenu ); 1053 action->addTo( importMenu );
1054 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1054 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1055#endif 1055#endif
1056 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 1056 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
1057 this ); 1057 this );
1058 action->addTo( importMenu ); 1058 action->addTo( importMenu );
1059 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1059 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1060 importMenu->insertSeparator(); 1060 importMenu->insertSeparator();
1061 importMenu->insertItem( i18n("Import"), importMenu_X ); 1061 importMenu->insertItem( i18n("Import"), importMenu_X );
1062 //importMenu->insertSeparator(); 1062 //importMenu->insertSeparator();
1063 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 1063 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
1064 this ); 1064 this );
1065 action->addTo( exportMenu_X ); 1065 action->addTo( exportMenu_X );
1066 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1066 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1067 1067
1068 1068
1069 //LR 1069 //LR
1070 QPopupMenu *ex2phone = new QPopupMenu( this ); 1070 QPopupMenu *ex2phone = new QPopupMenu( this );
1071 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1071 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1072 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1072 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1073 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1073 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1074 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1074 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1075 1075
1076 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1076 importMenu->insertItem( i18n("Export"), exportMenu_X );
1077#ifndef DESKTOP_VERSION 1077#ifndef DESKTOP_VERSION
1078 //importMenu->insertSeparator(); 1078 //importMenu->insertSeparator();
1079 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1079 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1080 this ); 1080 this );
1081 brAction->addTo( beamMenu_X ); 1081 brAction->addTo( beamMenu_X );
1082 brAction->setToggleAction (true ) ; 1082 brAction->setToggleAction (true ) ;
1083 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1083 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1084 1084
1085 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1085 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1086 this ); 1086 this );
1087 action->addTo( beamMenu_X ); 1087 action->addTo( beamMenu_X );
1088 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1088 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1089 1089
1090 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1090 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1091 this ); 1091 this );
1092 action->addTo( beamMenu_X ); 1092 action->addTo( beamMenu_X );
1093 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1093 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1094 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1094 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1095#else 1095#else
1096 //importMenu->insertSeparator(); 1096 //importMenu->insertSeparator();
1097 icon = loadPixmap( pathString + "print" ); 1097 icon = loadPixmap( pathString + "print" );
1098 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 );
1099 action->addTo( beamMenu_X ); 1099 action->addTo( beamMenu_X );
1100 connect( action, SIGNAL( activated() ), 1100 connect( action, SIGNAL( activated() ),
1101 this, SLOT( printCal() ) ); 1101 this, SLOT( printCal() ) );
1102 1102
1103 icon = loadPixmap( pathString + "print" ); 1103 icon = loadPixmap( pathString + "print" );
1104 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 );
1105 action->addTo( beamMenu_X ); 1105 action->addTo( beamMenu_X );
1106 connect( action, SIGNAL( activated() ), 1106 connect( action, SIGNAL( activated() ),
1107 this, SLOT( printSel() ) ); 1107 this, SLOT( printSel() ) );
1108 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 );
1109 action->addTo( beamMenu_X ); 1109 action->addTo( beamMenu_X );
1110 connect( action, SIGNAL( activated() ), 1110 connect( action, SIGNAL( activated() ),
1111 mView->viewManager(), SLOT( slotprintWNV() ) ); 1111 mView->viewManager(), SLOT( slotprintWNV() ) );
1112 1112
1113 1113
1114 icon = loadPixmap( pathString + "print" ); 1114 icon = loadPixmap( pathString + "print" );
1115 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 );
1116 action->addTo( beamMenu_X ); 1116 action->addTo( beamMenu_X );
1117 connect( action, SIGNAL( activated() ), 1117 connect( action, SIGNAL( activated() ),
1118 this, SLOT( printListView() ) ); 1118 this, SLOT( printListView() ) );
1119 1119
1120 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 );
1121 action->addTo( beamMenu_X ); 1121 action->addTo( beamMenu_X );
1122 connect( action, SIGNAL( activated() ), 1122 connect( action, SIGNAL( activated() ),
1123 mView, SLOT( slotprintSelInc() ) ); 1123 mView, SLOT( slotprintSelInc() ) );
1124 1124
1125 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1125 importMenu->insertItem( i18n("Print"), beamMenu_X );
1126#endif 1126#endif
1127 importMenu->insertSeparator(); 1127 importMenu->insertSeparator();
1128 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1128 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1129 this ); 1129 this );
1130 action->addTo( importMenu ); 1130 action->addTo( importMenu );
1131 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1131 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1132 importMenu->insertSeparator(); 1132 importMenu->insertSeparator();
1133 action = new QAction( "beam all", i18n("Save"), 0, 1133 action = new QAction( "beam all", i18n("Save"), 0,
1134 this ); 1134 this );
1135 action->addTo( importMenu ); 1135 action->addTo( importMenu );
1136 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1136 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1137 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1137 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1138 this ); 1138 this );
1139 action->addTo( importMenu ); 1139 action->addTo( importMenu );
1140 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1140 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1141 1141
1142 //menuBar->insertItem( "Configure",configureMenu ); 1142 //menuBar->insertItem( "Configure",configureMenu );
1143 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1143 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1144 icon = loadPixmap( "korganizer/korganizer" ); 1144 icon = loadPixmap( "korganizer/korganizer" );
1145 1145
1146 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1146 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1147 action->addTo( helpMenu ); 1147 action->addTo( helpMenu );
1148 connect( action, SIGNAL( activated() ), 1148 connect( action, SIGNAL( activated() ),
1149 SLOT( whatsNew() ) ); 1149 SLOT( whatsNew() ) );
1150 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1150 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1151 action->addTo( helpMenu ); 1151 action->addTo( helpMenu );
1152 connect( action, SIGNAL( activated() ), 1152 connect( action, SIGNAL( activated() ),
1153 SLOT( features() ) ); 1153 SLOT( features() ) );
1154 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1154 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1155 action->addTo( helpMenu ); 1155 action->addTo( helpMenu );
1156 connect( action, SIGNAL( activated() ), 1156 connect( action, SIGNAL( activated() ),
1157 SLOT( keyBindings() ) ); 1157 SLOT( keyBindings() ) );
1158 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1158 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1159 action->addTo( helpMenu ); 1159 action->addTo( helpMenu );
1160 connect( action, SIGNAL( activated() ), 1160 connect( action, SIGNAL( activated() ),
1161 SLOT( storagehowto() ) ); 1161 SLOT( storagehowto() ) );
1162 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1162 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1163 action->addTo( helpMenu ); 1163 action->addTo( helpMenu );
1164 connect( action, SIGNAL( activated() ), 1164 connect( action, SIGNAL( activated() ),
1165 SLOT( timetrackinghowto() ) ); 1165 SLOT( timetrackinghowto() ) );
1166 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1166 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1167 action->addTo( helpMenu ); 1167 action->addTo( helpMenu );
1168 connect( action, SIGNAL( activated() ), 1168 connect( action, SIGNAL( activated() ),
1169 SLOT( synchowto() ) ); 1169 SLOT( synchowto() ) );
1170 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 );
1171 action->addTo( helpMenu ); 1171 action->addTo( helpMenu );
1172 connect( action, SIGNAL( activated() ), 1172 connect( action, SIGNAL( activated() ),
1173 SLOT( kdesynchowto() ) ); 1173 SLOT( kdesynchowto() ) );
1174 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 );
1175 action->addTo( helpMenu ); 1175 action->addTo( helpMenu );
1176 connect( action, SIGNAL( activated() ), 1176 connect( action, SIGNAL( activated() ),
1177 SLOT( multisynchowto() ) ); 1177 SLOT( multisynchowto() ) );
1178 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1178 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1179 action->addTo( helpMenu ); 1179 action->addTo( helpMenu );
1180 connect( action, SIGNAL( activated() ), 1180 connect( action, SIGNAL( activated() ),
1181 SLOT( aboutAutoSaving() ) ); 1181 SLOT( aboutAutoSaving() ) );
1182 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1182 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1183 action->addTo( helpMenu ); 1183 action->addTo( helpMenu );
1184 connect( action, SIGNAL( activated() ), 1184 connect( action, SIGNAL( activated() ),
1185 SLOT( aboutKnownBugs() ) ); 1185 SLOT( aboutKnownBugs() ) );
1186 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1186 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1187 action->addTo( helpMenu ); 1187 action->addTo( helpMenu );
1188 connect( action, SIGNAL( activated() ), 1188 connect( action, SIGNAL( activated() ),
1189 SLOT( usertrans() ) ); 1189 SLOT( usertrans() ) );
1190 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1190 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1191 action->addTo( helpMenu ); 1191 action->addTo( helpMenu );
1192 connect( action, SIGNAL( activated() ), 1192 connect( action, SIGNAL( activated() ),
1193 SLOT( faq() ) ); 1193 SLOT( faq() ) );
1194 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1194 action = new QAction( "licence", i18n("Licence..."), 0, this );
1195 action->addTo( helpMenu ); 1195 action->addTo( helpMenu );
1196 connect( action, SIGNAL( activated() ), 1196 connect( action, SIGNAL( activated() ),
1197 SLOT( licence() ) ); 1197 SLOT( licence() ) );
1198 action = new QAction( "about", i18n("About..."), 0, this ); 1198 action = new QAction( "about", i18n("About..."), 0, this );
1199 action->addTo( helpMenu ); 1199 action->addTo( helpMenu );
1200 connect( action, SIGNAL( activated() ), 1200 connect( action, SIGNAL( activated() ),
1201 SLOT( about() ) ); 1201 SLOT( about() ) );
1202 //menuBar->insertSeparator(); 1202 //menuBar->insertSeparator();
1203 1203
1204 // ****************************************************** 1204 // ******************************************************
1205 // menubar icons 1205 // menubar icons
1206 1206
1207 1207
1208 1208
1209 //menuBar->insertItem( iconToolBar ); 1209 //menuBar->insertItem( iconToolBar );
1210 //xdays_action 1210 //xdays_action
1211 if (p-> mShowIconNewEvent) 1211 if (p-> mShowIconNewEvent)
1212 ne_action->addTo( iconToolBar ); 1212 ne_action->addTo( iconToolBar );
1213 if (p->mShowIconNewTodo ) 1213 if (p->mShowIconNewTodo )
1214 nt_action->addTo( iconToolBar ); 1214 nt_action->addTo( iconToolBar );
1215 if (p-> mShowIconSearch) 1215 if (p-> mShowIconSearch)
1216 search_action->addTo( iconToolBar ); 1216 search_action->addTo( iconToolBar );
1217 if (p-> mShowIconWhatsThis) 1217 if (p-> mShowIconWhatsThis)
1218 QWhatsThis::whatsThisButton ( iconToolBar ); 1218 QWhatsThis::whatsThisButton ( iconToolBar );
1219 if (p-> mShowIconNext) 1219 if (p-> mShowIconNext)
1220 whatsnext_action->addTo( viewToolBar ); 1220 whatsnext_action->addTo( viewToolBar );
1221 if (p-> mShowIconNextDays) 1221 if (p-> mShowIconNextDays)
1222 xdays_action->addTo( viewToolBar ); 1222 xdays_action->addTo( viewToolBar );
1223 if (p-> mShowIconJournal) 1223 if (p-> mShowIconJournal)
1224 viewjournal_action->addTo( viewToolBar ); 1224 viewjournal_action->addTo( viewToolBar );
1225 if (p-> mShowIconDay1) 1225 if (p-> mShowIconDay1)
1226 day1_action->addTo( viewToolBar ); 1226 day1_action->addTo( viewToolBar );
1227 if (p-> mShowIconDay5) 1227 if (p-> mShowIconDay5)
1228 day5_action->addTo( viewToolBar ); 1228 day5_action->addTo( viewToolBar );
1229 if (p-> mShowIconDay7) 1229 if (p-> mShowIconDay7)
1230 day7_action->addTo( viewToolBar ); 1230 day7_action->addTo( viewToolBar );
1231 if (p-> mShowIconDay6) 1231 if (p-> mShowIconDay6)
1232 day6_action->addTo( viewToolBar ); 1232 day6_action->addTo( viewToolBar );
1233 if (p-> mShowIconMonth) 1233 if (p-> mShowIconMonth)
1234 month_action->addTo( viewToolBar ); 1234 month_action->addTo( viewToolBar );
1235 if (p-> mShowIconList) 1235 if (p-> mShowIconList)
1236 showlist_action->addTo( viewToolBar ); 1236 showlist_action->addTo( viewToolBar );
1237 if (p-> mShowIconTodoview) 1237 if (p-> mShowIconTodoview)
1238 todoview_action->addTo( viewToolBar ); 1238 todoview_action->addTo( viewToolBar );
1239 1239
1240 icon = loadPixmap( pathString + "2leftarrowB" ); 1240 icon = loadPixmap( pathString + "2leftarrowB" );
1241 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1241 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1242 if (p-> mShowIconBackFast) { 1242 if (p-> mShowIconBackFast) {
1243 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 );
1244 connect( action, SIGNAL( activated() ), 1244 connect( action, SIGNAL( activated() ),
1245 mView, SLOT( goPreviousMonth() ) ); 1245 mView, SLOT( goPreviousMonth() ) );
1246 action->addTo( navigatorToolBar ); 1246 action->addTo( navigatorToolBar );
1247 } 1247 }
1248 icon = loadPixmap( pathString + "1leftarrowB" ); 1248 icon = loadPixmap( pathString + "1leftarrowB" );
1249 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1249 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1250 if (p-> mShowIconBack) { 1250 if (p-> mShowIconBack) {
1251 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 );
1252 connect( action, SIGNAL( activated() ), 1252 connect( action, SIGNAL( activated() ),
1253 mView, SLOT( goPrevious() ) ); 1253 mView, SLOT( goPrevious() ) );
1254 action->addTo( navigatorToolBar ); 1254 action->addTo( navigatorToolBar );
1255 } 1255 }
1256 icon = loadPixmap( pathString + "today" ); 1256 icon = loadPixmap( pathString + "today" );
1257 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1257 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1258 if (p-> mShowIconToday) 1258 if (p-> mShowIconToday)
1259 today_action->addTo( navigatorToolBar ); 1259 today_action->addTo( navigatorToolBar );
1260 icon = loadPixmap( pathString + "1rightarrowB" ); 1260 icon = loadPixmap( pathString + "1rightarrowB" );
1261 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1261 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1262 if (p-> mShowIconForward) { 1262 if (p-> mShowIconForward) {
1263 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 );
1264 connect( action, SIGNAL( activated() ), 1264 connect( action, SIGNAL( activated() ),
1265 mView, SLOT( goNext() ) ); 1265 mView, SLOT( goNext() ) );
1266 action->addTo( navigatorToolBar ); 1266 action->addTo( navigatorToolBar );
1267 } 1267 }
1268 icon = loadPixmap( pathString + "2rightarrowB" ); 1268 icon = loadPixmap( pathString + "2rightarrowB" );
1269 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1269 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1270 if (p-> mShowIconForwardFast) { 1270 if (p-> mShowIconForwardFast) {
1271 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 );
1272 connect( action, SIGNAL( activated() ), 1272 connect( action, SIGNAL( activated() ),
1273 mView, SLOT( goNextMonth() ) ); 1273 mView, SLOT( goNextMonth() ) );
1274 action->addTo( navigatorToolBar ); 1274 action->addTo( navigatorToolBar );
1275 } 1275 }
1276 1276
1277 1277
1278 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1278 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1279 1279
1280 1280
1281 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1281 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1282 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1282 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1283 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1283 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1284 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1284 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1285 1285
1286 if (p-> mShowIconNewEvent) 1286 if (p-> mShowIconNewEvent)
1287 configureToolBarMenu->setItemChecked( 10, true ); 1287 configureToolBarMenu->setItemChecked( 10, true );
1288 if (p->mShowIconNewTodo ) 1288 if (p->mShowIconNewTodo )
1289 configureToolBarMenu->setItemChecked( 20, true ); 1289 configureToolBarMenu->setItemChecked( 20, true );
1290 if (p-> mShowIconSearch) 1290 if (p-> mShowIconSearch)
1291 configureToolBarMenu->setItemChecked( 120, true ); 1291 configureToolBarMenu->setItemChecked( 120, true );
1292 if (p-> mShowIconList) 1292 if (p-> mShowIconList)
1293 configureToolBarMenu->setItemChecked( 30, true ); 1293 configureToolBarMenu->setItemChecked( 30, true );
1294 if (p-> mShowIconDay1) 1294 if (p-> mShowIconDay1)
1295 configureToolBarMenu->setItemChecked( 40, true ); 1295 configureToolBarMenu->setItemChecked( 40, true );
1296 if (p-> mShowIconDay5) 1296 if (p-> mShowIconDay5)
1297 configureToolBarMenu->setItemChecked( 50, true ); 1297 configureToolBarMenu->setItemChecked( 50, true );
1298 if (p-> mShowIconDay6) 1298 if (p-> mShowIconDay6)
1299 configureToolBarMenu->setItemChecked( 75, true ); 1299 configureToolBarMenu->setItemChecked( 75, true );
1300 if (p-> mShowIconDay7) 1300 if (p-> mShowIconDay7)
1301 configureToolBarMenu->setItemChecked( 60, true ); 1301 configureToolBarMenu->setItemChecked( 60, true );
1302 if (p-> mShowIconMonth) 1302 if (p-> mShowIconMonth)
1303 configureToolBarMenu->setItemChecked( 70, true ); 1303 configureToolBarMenu->setItemChecked( 70, true );
1304 if (p-> mShowIconTodoview) 1304 if (p-> mShowIconTodoview)
1305 configureToolBarMenu->setItemChecked( 80, true ); 1305 configureToolBarMenu->setItemChecked( 80, true );
1306 if (p-> mShowIconBackFast) 1306 if (p-> mShowIconBackFast)
1307 configureToolBarMenu->setItemChecked( 200, true ); 1307 configureToolBarMenu->setItemChecked( 200, true );
1308 if (p-> mShowIconBack) 1308 if (p-> mShowIconBack)
1309 configureToolBarMenu->setItemChecked( 210, true ); 1309 configureToolBarMenu->setItemChecked( 210, true );
1310 if (p-> mShowIconToday) 1310 if (p-> mShowIconToday)
1311 configureToolBarMenu->setItemChecked( 130, true ); 1311 configureToolBarMenu->setItemChecked( 130, true );
1312 if (p-> mShowIconForward) 1312 if (p-> mShowIconForward)
1313 configureToolBarMenu->setItemChecked( 220, true ); 1313 configureToolBarMenu->setItemChecked( 220, true );
1314 if (p-> mShowIconForwardFast) 1314 if (p-> mShowIconForwardFast)
1315 configureToolBarMenu->setItemChecked( 230, true ); 1315 configureToolBarMenu->setItemChecked( 230, true );
1316 if (p-> mShowIconNextDays) 1316 if (p-> mShowIconNextDays)
1317 configureToolBarMenu->setItemChecked( 100, true ); 1317 configureToolBarMenu->setItemChecked( 100, true );
1318 if (p-> mShowIconNext) 1318 if (p-> mShowIconNext)
1319 configureToolBarMenu->setItemChecked( 110, true ); 1319 configureToolBarMenu->setItemChecked( 110, true );
1320 if (p-> mShowIconJournal) 1320 if (p-> mShowIconJournal)
1321 configureToolBarMenu->setItemChecked( 90, true ); 1321 configureToolBarMenu->setItemChecked( 90, true );
1322 if (p-> mShowIconWhatsThis) 1322 if (p-> mShowIconWhatsThis)
1323 configureToolBarMenu->setItemChecked( 300, true ); 1323 configureToolBarMenu->setItemChecked( 300, true );
1324 if (p-> mShowIconWeekNum) 1324 if (p-> mShowIconWeekNum)
1325 configureToolBarMenu->setItemChecked( 400, true ); 1325 configureToolBarMenu->setItemChecked( 400, true );
1326 if (!p-> mShowIconStretch) { 1326 if (!p-> mShowIconStretch) {
1327 QLabel* dummy = new QLabel( iconToolBar ); 1327 QLabel* dummy = new QLabel( iconToolBar );
1328 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1328 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1329 dummy->setMinimumWidth( 0 ); 1329 dummy->setMinimumWidth( 0 );
1330 iconToolBar->setStretchableWidget ( dummy ) ; 1330 iconToolBar->setStretchableWidget ( dummy ) ;
1331 } 1331 }
1332 else { 1332 else {
1333 iconToolBar->setHorizontalStretchable (true ); 1333 iconToolBar->setHorizontalStretchable (true );
1334 viewToolBar->setHorizontalStretchable (true ); 1334 viewToolBar->setHorizontalStretchable (true );
1335 navigatorToolBar->setHorizontalStretchable (true ); 1335 navigatorToolBar->setHorizontalStretchable (true );
1336 iconToolBar->setVerticalStretchable (true ); 1336 iconToolBar->setVerticalStretchable (true );
1337 viewToolBar->setVerticalStretchable (true ); 1337 viewToolBar->setVerticalStretchable (true );
1338 navigatorToolBar->setVerticalStretchable (true ); 1338 navigatorToolBar->setVerticalStretchable (true );
1339 configureToolBarMenu->setItemChecked( 5, true ); 1339 configureToolBarMenu->setItemChecked( 5, true );
1340 } 1340 }
1341 if (p-> mShowIconFilter) 1341 if (p-> mShowIconFilter)
1342 configureToolBarMenu->setItemChecked( 7, true ); 1342 configureToolBarMenu->setItemChecked( 7, true );
1343 if (p-> mShowIconOnetoolbar) 1343 if (p-> mShowIconOnetoolbar)
1344 configureToolBarMenu->setItemChecked( 6, true ); 1344 configureToolBarMenu->setItemChecked( 6, true );
1345 1345
1346 1346
1347 if ( filterMenubar ) { 1347 if ( filterMenubar ) {
1348 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1348 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1349 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); 1349 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) );
1350 } 1350 }
1351 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1351 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1352 configureAgenda( p->mHourSize ); 1352 configureAgenda( p->mHourSize );
1353 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1353 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1354} 1354}
1355 1355
1356void MainWindow::exportToPhone( int mode ) 1356void MainWindow::exportToPhone( int mode )
1357{ 1357{
1358 1358
1359 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1359 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1360 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1360 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1361 KOex2phonePrefs ex2phone; 1361 KOex2phonePrefs ex2phone;
1362 1362
1363 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1363 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1364 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1364 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1365 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1365 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1366 if ( mode == 1 ) 1366 if ( mode == 1 )
1367 ex2phone.setCaption(i18n("Export complete calendar")); 1367 ex2phone.setCaption(i18n("Export complete calendar"));
1368 if ( mode == 2 ) 1368 if ( mode == 2 )
1369 ex2phone.setCaption(i18n("Export filtered calendar")); 1369 ex2phone.setCaption(i18n("Export filtered calendar"));
1370 1370
1371 if ( !ex2phone.exec() ) { 1371 if ( !ex2phone.exec() ) {
1372 return; 1372 return;
1373 } 1373 }
1374 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1374 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1375 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1375 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1376 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1376 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1377 1377
1378 int inFuture = 0; 1378 int inFuture = 0;
1379 if ( ex2phone.mWriteBackFuture->isChecked() ) 1379 if ( ex2phone.mWriteBackFuture->isChecked() )
1380 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1380 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1381 QPtrList<Incidence> delSel; 1381 QPtrList<Incidence> delSel;
1382 if ( mode == 1 ) 1382 if ( mode == 1 )
1383 delSel = mCalendar->rawIncidences(); 1383 delSel = mCalendar->rawIncidences();
1384 if ( mode == 2 ) 1384 if ( mode == 2 )
1385 delSel = mCalendar->incidences(); 1385 delSel = mCalendar->incidences();
1386 CalendarLocal* cal = new CalendarLocal(); 1386 CalendarLocal* cal = new CalendarLocal();
1387 cal->setLocalTime(); 1387 cal->setLocalTime();
1388 Incidence *incidence = delSel.first(); 1388 Incidence *incidence = delSel.first();
1389 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1389 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1390 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1390 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1391 while ( incidence ) { 1391 while ( incidence ) {
1392 if ( incidence->typeID() != journalID ) { 1392 if ( incidence->typeID() != journalID ) {
1393 bool add = true; 1393 bool add = true;
1394 if ( inFuture ) { 1394 if ( inFuture ) {
1395 QDateTime dt; 1395 QDateTime dt;
1396 if ( incidence->typeID() == todoID ) { 1396 if ( incidence->typeID() == todoID ) {
1397 Todo * t = (Todo*)incidence; 1397 Todo * t = (Todo*)incidence;
1398 if ( t->hasDueDate() ) 1398 if ( t->hasDueDate() )
1399 dt = t->dtDue(); 1399 dt = t->dtDue();
1400 else 1400 else
1401 dt = cur.addSecs( 62 ); 1401 dt = cur.addSecs( 62 );
1402 } 1402 }
1403 else { 1403 else {
1404 bool ok; 1404 bool ok;
1405 dt = incidence->getNextOccurence( cur, &ok ); 1405 dt = incidence->getNextOccurence( cur, &ok );
1406 if ( !ok ) 1406 if ( !ok )
1407 dt = cur.addSecs( -62 ); 1407 dt = cur.addSecs( -62 );
1408 } 1408 }
1409 if ( dt < cur || dt > end ) { 1409 if ( dt < cur || dt > end ) {
1410 add = false; 1410 add = false;
1411 } 1411 }
1412 } 1412 }
1413 if ( add ) { 1413 if ( add ) {
1414 Incidence *in = incidence->clone(); 1414 Incidence *in = incidence->clone();
1415 cal->addIncidence( in ); 1415 cal->addIncidence( in );
1416 } 1416 }
1417 } 1417 }
1418 incidence = delSel.next(); 1418 incidence = delSel.next();
1419 } 1419 }
1420 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1420 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1421 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1421 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1422 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1422 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1423 1423
1424 setCaption( i18n("Writing to phone...")); 1424 setCaption( i18n("Writing to phone..."));
1425 if ( PhoneFormat::writeToPhone( cal ) ) 1425 if ( PhoneFormat::writeToPhone( cal ) )
1426 setCaption( i18n("Export to phone successful!")); 1426 setCaption( i18n("Export to phone successful!"));
1427 else 1427 else
1428 setCaption( i18n("Error exporting to phone!")); 1428 setCaption( i18n("Error exporting to phone!"));
1429 delete cal; 1429 delete cal;
1430} 1430}
1431 1431
1432 1432
1433void MainWindow::setDefaultPreferences() 1433void MainWindow::setDefaultPreferences()
1434{ 1434{
1435 KOPrefs *p = KOPrefs::instance(); 1435 KOPrefs *p = KOPrefs::instance();
1436 1436
1437 p->mCompactDialogs = true; 1437 p->mCompactDialogs = true;
1438 p->mConfirm = true; 1438 p->mConfirm = true;
1439 // p->mEnableQuickTodo = false; 1439 // p->mEnableQuickTodo = false;
1440 1440
1441} 1441}
1442 1442
1443QString MainWindow::resourcePath() 1443QString MainWindow::resourcePath()
1444{ 1444{
1445 return KGlobal::iconLoader()->iconPath(); 1445 return KGlobal::iconLoader()->iconPath();
1446} 1446}
1447 1447
1448void MainWindow::displayText( QString text ,QString cap ) 1448void MainWindow::displayText( QString text ,QString cap )
1449{ 1449{
1450 QDialog dia( this, "name", true ); ; 1450 QDialog dia( this, "name", true ); ;
1451 dia.setCaption( cap ); 1451 dia.setCaption( cap );
1452 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1452 QVBoxLayout* lay = new QVBoxLayout( &dia );
1453 lay->setSpacing( 3 ); 1453 lay->setSpacing( 3 );
1454 lay->setMargin( 3 ); 1454 lay->setMargin( 3 );
1455 QTextBrowser tb ( &dia ); 1455 QTextBrowser tb ( &dia );
1456 lay->addWidget( &tb ); 1456 lay->addWidget( &tb );
1457 tb.setText( text ); 1457 tb.setText( text );
1458#ifdef DESKTOP_VERSION 1458#ifdef DESKTOP_VERSION
1459 dia.resize( 640, 480); 1459 dia.resize( 640, 480);
1460#else 1460#else
1461 dia.showMaximized(); 1461 dia.showMaximized();
1462#endif 1462#endif
1463 dia.exec(); 1463 dia.exec();
1464} 1464}
1465 1465
1466void MainWindow::features() 1466void MainWindow::features()
1467{ 1467{
1468 1468
1469 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" );
1470} 1470}
1471 1471
1472void MainWindow::usertrans() 1472void MainWindow::usertrans()
1473{ 1473{
1474 1474
1475 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" );
1476} 1476}
1477 1477
1478void MainWindow::storagehowto() 1478void MainWindow::storagehowto()
1479{ 1479{
1480 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1480 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1481} 1481}
1482void MainWindow::timetrackinghowto() 1482void MainWindow::timetrackinghowto()
1483{ 1483{
1484 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1484 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1485} 1485}
1486void MainWindow::kdesynchowto() 1486void MainWindow::kdesynchowto()
1487{ 1487{
1488 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" );
1489} 1489}
1490void MainWindow::multisynchowto() 1490void MainWindow::multisynchowto()
1491{ 1491{
1492 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1492 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1493} 1493}
1494void MainWindow::synchowto() 1494void MainWindow::synchowto()
1495{ 1495{
1496 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1496 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1497} 1497}
1498void MainWindow::faq() 1498void MainWindow::faq()
1499{ 1499{
1500 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1500 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1501 1501
1502} 1502}
1503void MainWindow::whatsNew() 1503void MainWindow::whatsNew()
1504{ 1504{
1505 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1505 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1506 1506
1507} 1507}
1508void MainWindow::licence() 1508void MainWindow::licence()
1509{ 1509{
1510 KApplication::showLicence(); 1510 KApplication::showLicence();
1511 1511
1512} 1512}
1513void MainWindow::about() 1513void MainWindow::about()
1514{ 1514{
1515 QString version; 1515 QString version;
1516#include <../version> 1516#include <../version>
1517 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1517 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1518 i18n("KOrganizer/Platform-independent\n") + 1518 i18n("KOrganizer/Platform-independent\n") +
1519 "(KO/Pi) " + version + " - " + 1519 "(KO/Pi) " + version + " - " +
1520 1520
1521#ifdef DESKTOP_VERSION 1521#ifdef DESKTOP_VERSION
1522 i18n("Desktop Edition\n") + 1522 i18n("Desktop Edition\n") +
1523#else 1523#else
1524 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1524 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1525#endif 1525#endif
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 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!") );
1527} 1527}
1528void MainWindow::keyBindings() 1528void MainWindow::keyBindings()
1529{ 1529{
1530 QString cap = i18n("KO/Pi Keys + Colors"); 1530 QString cap = i18n("KO/Pi Keys + Colors");
1531 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") +
1532 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")+
1533 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") +
1534 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") +
1535 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") +
1536 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")+
1537 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")+
1538 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")+
1539 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")+
1540 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 ")+
1541 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")+
1542 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")+
1543 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")+
1544 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")+
1545 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")+
1546 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")+
1547 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")+
1548 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")+
1549 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")+
1550 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")+
1551 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")+
1552 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")+
1553 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1553 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1554 i18n("<p><h3>In agenda view:</h3></p>\n") + 1554 i18n("<p><h3>In agenda view:</h3></p>\n") +
1555 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1555 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1556 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")+
1557 i18n("<p><h3>In todo view:</h3></p>\n") + 1557 i18n("<p><h3>In todo view:</h3></p>\n") +
1558 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")+
1559 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")+
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>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1561 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")+
1562 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")+
1563 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")+
1564 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")+
1565 i18n("<p><h3>In list view:</h3></p>\n") + 1565 i18n("<p><h3>In list view:</h3></p>\n") +
1566 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")+
1567 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")+
1568 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")+
1569 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1569 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1570 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")+
1571 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")+
1572 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1572 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1573 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1573 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1574 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1574 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1575 i18n("<p><b>E</b>: Edit item</p>\n") + 1575 i18n("<p><b>E</b>: Edit item</p>\n") +
1576 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1576 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1577 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") +
1578 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")+
1579 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")+
1580 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")+
1581 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")+
1582 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")+
1583 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") +
1584 i18n("<p><b>White</b>: Item readonly</p>\n"); 1584 i18n("<p><b>White</b>: Item readonly</p>\n");
1585 displayText( text, cap); 1585 displayText( text, cap);
1586} 1586}
1587void MainWindow::aboutAutoSaving() 1587void MainWindow::aboutAutoSaving()
1588{ 1588{
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 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");
1590 1590
1591 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1591 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1592 1592
1593} 1593}
1594void MainWindow::aboutKnownBugs() 1594void MainWindow::aboutKnownBugs()
1595{ 1595{
1596 QMessageBox* msg; 1596 QMessageBox* msg;
1597 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1597 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
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("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")+
1599 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")+
1600 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1600 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1601 i18n("\nor report them in the bugtracker on\n") + 1601 i18n("\nor report them in the bugtracker on\n") +
1602 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1602 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1603 QMessageBox::NoIcon, 1603 QMessageBox::NoIcon,
1604 QMessageBox::Ok, 1604 QMessageBox::Ok,
1605 QMessageBox::NoButton, 1605 QMessageBox::NoButton,
1606 QMessageBox::NoButton); 1606 QMessageBox::NoButton);
1607 msg->exec(); 1607 msg->exec();
1608 delete msg; 1608 delete msg;
1609 1609
1610} 1610}
1611 1611
1612QString MainWindow::defaultFileName() 1612QString MainWindow::defaultFileName()
1613{ 1613{
1614 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1614 return locateLocal( "data", "korganizer/mycalendar.ics" );
1615} 1615}
1616QString MainWindow::syncFileName() 1616QString MainWindow::syncFileName()
1617{ 1617{
1618#ifdef DESKTOP_VERSION 1618#ifdef DESKTOP_VERSION
1619 return locateLocal( "tmp", "synccalendar.ics" ); 1619 return locateLocal( "tmp", "synccalendar.ics" );
1620#else 1620#else
1621 return QString( "/tmp/synccalendar.ics" ); 1621 return QString( "/tmp/synccalendar.ics" );
1622#endif 1622#endif
1623} 1623}
1624#include "koglobals.h" 1624#include "koglobals.h"
1625#include <kcalendarsystem.h> 1625#include <kcalendarsystem.h>
1626void MainWindow::updateWeek(QDate seda) 1626void MainWindow::updateWeek(QDate seda)
1627{ 1627{
1628 int weekNum = KGlobal::locale()->weekNum ( seda ); 1628 int weekNum = KGlobal::locale()->weekNum ( seda );
1629 mWeekPixmap.fill( mWeekBgColor ); 1629 mWeekPixmap.fill( mWeekBgColor );
1630 QPainter p ( &mWeekPixmap ); 1630 QPainter p ( &mWeekPixmap );
1631 p.setFont( mWeekFont ); 1631 p.setFont( mWeekFont );
1632 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) );
1633 p.end(); 1633 p.end();
1634 QIconSet icon3 ( mWeekPixmap ); 1634 QIconSet icon3 ( mWeekPixmap );
1635 mWeekAction->setIconSet ( icon3 ); 1635 mWeekAction->setIconSet ( icon3 );
1636 1636
1637} 1637}
1638void MainWindow::updateWeekNum(const DateList &selectedDates) 1638void MainWindow::updateWeekNum(const DateList &selectedDates)
1639{ 1639{
1640 updateWeek( selectedDates.first() ); 1640 updateWeek( selectedDates.first() );
1641} 1641}
1642void MainWindow::processIncidenceSelection( Incidence *incidence ) 1642void MainWindow::processIncidenceSelection( Incidence *incidence )
1643{ 1643{
1644 1644
1645 if ( !incidence ) { 1645 if ( !incidence ) {
1646 enableIncidenceActions( false ); 1646 enableIncidenceActions( false );
1647 1647
1648 mNewSubTodoAction->setEnabled( false ); 1648 mNewSubTodoAction->setEnabled( false );
1649 setCaptionToDates(); 1649 setCaptionToDates();
1650 return; 1650 return;
1651 1651
1652 } 1652 }
1653 1653
1654 //KGlobal::locale()->formatDateTime(nextA, true); 1654 //KGlobal::locale()->formatDateTime(nextA, true);
1655 QString startString = ""; 1655 QString startString = "";
1656 if ( incidence->typeID() != todoID ) { 1656 if ( incidence->typeID() != todoID ) {
1657 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1657 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1658 if ( incidence->doesFloat() ) { 1658 if ( incidence->doesFloat() ) {
1659 startString += ": "+incidence->dtStartDateStr( true ); 1659 startString += ": "+incidence->dtStartDateStr( true );
1660 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1660 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1661 1661
1662 } else { 1662 } else {
1663 startString = ": "+incidence->dtStartStr(true); 1663 startString = ": "+incidence->dtStartStr(true);
1664 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1664 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1665 1665
1666 } 1666 }
1667 1667
1668 } else { 1668 } else {
1669 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1669 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1670 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1670 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1671 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1671 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1672 1672
1673 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1673 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1674 bool ok; 1674 bool ok;
1675 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1675 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1676 if ( ok ) { 1676 if ( ok ) {
1677 int years = noc.date().year() - incidence->dtStart().date().year(); 1677 int years = noc.date().year() - incidence->dtStart().date().year();
1678 startString += i18n(" (%1 y.)"). arg( years ); 1678 startString += i18n(" (%1 y.)"). arg( years );
1679 } 1679 }
1680 } 1680 }
1681 else 1681 else
1682 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1682 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1683 } 1683 }
1684 1684
1685 } 1685 }
1686 else 1686 else
1687 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");
1688 if ( !incidence->location().isEmpty() ) 1688 if ( !incidence->location().isEmpty() )
1689 startString += " (" +incidence->location()+")"; 1689 startString += " (" +incidence->location()+")";
1690 setCaption( incidence->summary()+startString); 1690 setCaption( incidence->summary()+startString);
1691 1691
1692 enableIncidenceActions( true ); 1692 enableIncidenceActions( true );
1693 1693
1694 if ( incidence->typeID() == eventID ) { 1694 if ( incidence->typeID() == eventID ) {
1695 mShowAction->setText( i18n("Show Event...") ); 1695 mShowAction->setText( i18n("Show Event...") );
1696 mEditAction->setText( i18n("Edit Event...") ); 1696 mEditAction->setText( i18n("Edit Event...") );
1697 mDeleteAction->setText( i18n("Delete Event...") ); 1697 mDeleteAction->setText( i18n("Delete Event...") );
1698 1698
1699 mNewSubTodoAction->setEnabled( false ); 1699 mNewSubTodoAction->setEnabled( false );
1700 } else if ( incidence->typeID() == todoID ) { 1700 } else if ( incidence->typeID() == todoID ) {
1701 mShowAction->setText( i18n("Show Todo...") ); 1701 mShowAction->setText( i18n("Show Todo...") );
1702 mEditAction->setText( i18n("Edit Todo...") ); 1702 mEditAction->setText( i18n("Edit Todo...") );
1703 mDeleteAction->setText( i18n("Delete Todo...") ); 1703 mDeleteAction->setText( i18n("Delete Todo...") );
1704 1704
1705 mNewSubTodoAction->setEnabled( true ); 1705 mNewSubTodoAction->setEnabled( true );
1706 } else { 1706 } else {
1707 mShowAction->setText( i18n("Show...") ); 1707 mShowAction->setText( i18n("Show...") );
1708 mShowAction->setText( i18n("Edit...") ); 1708 mShowAction->setText( i18n("Edit...") );
1709 mShowAction->setText( i18n("Delete...") ); 1709 mShowAction->setText( i18n("Delete...") );
1710 1710
1711 mNewSubTodoAction->setEnabled( false ); 1711 mNewSubTodoAction->setEnabled( false );
1712 } 1712 }
1713} 1713}
1714 1714
1715void MainWindow::enableIncidenceActions( bool enabled ) 1715void MainWindow::enableIncidenceActions( bool enabled )
1716{ 1716{
1717 mShowAction->setEnabled( enabled ); 1717 mShowAction->setEnabled( enabled );
1718 mEditAction->setEnabled( enabled ); 1718 mEditAction->setEnabled( enabled );
1719 mDeleteAction->setEnabled( enabled ); 1719 mDeleteAction->setEnabled( enabled );
1720 1720
1721 mCloneAction->setEnabled( enabled ); 1721 mCloneAction->setEnabled( enabled );
1722 mMoveAction->setEnabled( enabled ); 1722 mMoveAction->setEnabled( enabled );
1723 mBeamAction->setEnabled( enabled ); 1723 mBeamAction->setEnabled( enabled );
1724 mCancelAction->setEnabled( enabled ); 1724 mCancelAction->setEnabled( enabled );
1725} 1725}
1726 1726
1727void MainWindow::importOL() 1727void MainWindow::importOL()
1728{ 1728{
1729#ifdef _OL_IMPORT_ 1729#ifdef _OL_IMPORT_
1730 mView->clearAllViews(); 1730 mView->clearAllViews();
1731 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 );
1732 id->exec(); 1732 id->exec();
1733 delete id; 1733 delete id;
1734 mView->calendar()->checkAlarmForIncidence( 0, true ); 1734 mView->calendar()->checkAlarmForIncidence( 0, true );
1735 mView->updateView(); 1735 mView->updateView();
1736#endif 1736#endif
1737} 1737}
1738void MainWindow::importBday() 1738void MainWindow::importBday()
1739{ 1739{
1740 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), 1740 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"),
1741 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"),
1742 i18n("Import!"), i18n("Cancel"), 0, 1742 i18n("Import!"), i18n("Cancel"), 0,
1743 0, 1 ); 1743 0, 1 );
1744 if ( result == 0 ) { 1744 if ( result == 0 ) {
1745 mView->importBday(); 1745 mView->importBday();
1746 1746
1747 } 1747 }
1748 1748
1749 1749
1750} 1750}
1751void MainWindow::importQtopia() 1751void MainWindow::importQtopia()
1752{ 1752{
1753 //#ifndef DESKTOP_VERSION 1753 //#ifndef DESKTOP_VERSION
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 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");
1755#ifdef DESKTOP_VERSION 1755#ifdef DESKTOP_VERSION
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 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");
1757#endif 1757#endif
1758 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1758 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1759 i18n("Import!"), i18n("Cancel"), 0, 1759 i18n("Import!"), i18n("Cancel"), 0,
1760 0, 1 ); 1760 0, 1 );
1761 if ( result == 0 ) { 1761 if ( result == 0 ) {
1762#ifndef DESKTOP_VERSION 1762#ifndef DESKTOP_VERSION
1763 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1763 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1764 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1764 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1765 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1765 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1766#else 1766#else
1767 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1767 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1768 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1768 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1769 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1769 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1770#endif 1770#endif
1771 mView->importQtopia( categories, datebook, todolist ); 1771 mView->importQtopia( categories, datebook, todolist );
1772 } 1772 }
1773 mView->calendar()->reInitAlarmSettings(); 1773 mView->calendar()->reInitAlarmSettings();
1774#if 0 1774#if 0
1775 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1775 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1776 i18n("Not supported \non desktop!\n"), 1776 i18n("Not supported \non desktop!\n"),
1777 i18n("Ok"), i18n("Cancel"), 0, 1777 i18n("Ok"), i18n("Cancel"), 0,
1778 0, 1 ); 1778 0, 1 );
1779 1779
1780#endif 1780#endif
1781} 1781}
1782 1782
1783void MainWindow::saveOnClose() 1783void MainWindow::saveOnClose()
1784{ 1784{
1785 KOPrefs *p = KOPrefs::instance(); 1785 KOPrefs *p = KOPrefs::instance();
1786 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1786 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1787 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1787 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1788 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1788 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1789 if ( filterToolBar ) { 1789 if ( filterToolBar ) {
1790 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1790 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1791 } 1791 }
1792#ifdef DESKTOP_VERSION 1792#ifdef DESKTOP_VERSION
1793 1793
1794 QPoint myP; 1794 QPoint myP;
1795 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1795 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1796 if ( p->mToolBarHor ) 1796 if ( p->mToolBarHor )
1797 p->mToolBarUp = myP.y() > height()/2; 1797 p->mToolBarUp = myP.y() > height()/2;
1798 else 1798 else
1799 p->mToolBarUp = myP.x() > width()/2; 1799 p->mToolBarUp = myP.x() > width()/2;
1800 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1800 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1801 if ( p->mToolBarHorV ) 1801 if ( p->mToolBarHorV )
1802 p->mToolBarUpV = myP.y() > height()/2; 1802 p->mToolBarUpV = myP.y() > height()/2;
1803 else 1803 else
1804 p->mToolBarUpV = myP.x() > width()/2 ; 1804 p->mToolBarUpV = myP.x() > width()/2 ;
1805 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1805 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1806 if ( p->mToolBarHorN ) 1806 if ( p->mToolBarHorN )
1807 p->mToolBarUpN = myP.y() > height()/2; 1807 p->mToolBarUpN = myP.y() > height()/2;
1808 else 1808 else
1809 p->mToolBarUpN = myP.x() > width()/2 ; 1809 p->mToolBarUpN = myP.x() > width()/2 ;
1810 if ( filterToolBar ) { 1810 if ( filterToolBar ) {
1811 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1811 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1812 if ( p->mToolBarHorF ) 1812 if ( p->mToolBarHorF )
1813 p->mToolBarUpF = myP.y() > height()/2; 1813 p->mToolBarUpF = myP.y() > height()/2;
1814 else 1814 else
1815 p->mToolBarUpF = myP.x() > width()/2 ; 1815 p->mToolBarUpF = myP.x() > width()/2 ;
1816 } 1816 }
1817#else 1817#else
1818 if ( p->mToolBarHor ) 1818 if ( p->mToolBarHor )
1819 p->mToolBarUp = iconToolBar->y() > height()/2; 1819 p->mToolBarUp = iconToolBar->y() > height()/2;
1820 else 1820 else
1821 p->mToolBarUp = iconToolBar->x() > width()/2; 1821 p->mToolBarUp = iconToolBar->x() > width()/2;
1822 if ( p->mToolBarHorV ) 1822 if ( p->mToolBarHorV )
1823 p->mToolBarUpV = viewToolBar->y() > height()/2; 1823 p->mToolBarUpV = viewToolBar->y() > height()/2;
1824 else 1824 else
1825 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1825 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1826 1826
1827 if ( p->mToolBarHorN ) 1827 if ( p->mToolBarHorN )
1828 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1828 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1829 else 1829 else
1830 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1830 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1831 if ( filterToolBar ) { 1831 if ( filterToolBar ) {
1832 if ( p->mToolBarHorF ) 1832 if ( p->mToolBarHorF )
1833 p->mToolBarUpF = filterToolBar->y() > height()/2; 1833 p->mToolBarUpF = filterToolBar->y() > height()/2;
1834 else 1834 else
1835 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1835 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1836 } 1836 }
1837#endif 1837#endif
1838 if ( mView->viewManager()->journalView() ) 1838
1839 mView->viewManager()->journalView()->checkModified(); 1839 save();
1840 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1841 save();
1842 mView->writeSettings(); 1840 mView->writeSettings();
1843} 1841}
1844void MainWindow::slotModifiedChanged( bool changed ) 1842void MainWindow::slotModifiedChanged( bool changed )
1845{ 1843{
1846 if ( mBlockAtStartup ) 1844 if ( mBlockAtStartup )
1847 return; 1845 return;
1848 1846
1849 int msec; 1847 int msec;
1850 // we store the changes after 1 minute, 1848 // we store the changes after 1 minute,
1851 // and for safety reasons after 10 minutes again 1849 // and for safety reasons after 10 minutes again
1852 if ( !mSyncManager->blockSave() ) 1850 if ( !mSyncManager->blockSave() )
1853 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1851 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1854 else 1852 else
1855 msec = 1000 * 600; 1853 msec = 1000 * 600;
1856 mSaveTimer.start( msec, true ); // 1 minute 1854 mSaveTimer.start( msec, true ); // 1 minute
1857 qDebug("KO: Saving File in %d secs!", msec/1000); 1855 qDebug("KO: Saving File in %d secs!", msec/1000);
1858 mCalendarModifiedFlag = true; 1856 mCalendarModifiedFlag = true;
1859} 1857}
1860void MainWindow::saveStopTimer() 1858void MainWindow::saveStopTimer()
1861{ 1859{
1862 mSaveTimer.stop(); 1860 mSaveTimer.stop();
1863} 1861}
1864void MainWindow::backupAllFiles() 1862void MainWindow::backupAllFiles()
1865{ 1863{
1866 QDate reference ( 2000,1,1); 1864 QDate reference ( 2000,1,1);
1867 int daysTo = reference.daysTo ( QDate::currentDate() ); 1865 int daysTo = reference.daysTo ( QDate::currentDate() );
1868 setCaption(i18n("Creating backup ... please wait ..." )); 1866 setCaption(i18n("Creating backup ... please wait ..." ));
1869 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 1867 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
1870 // we need the file path, the backup dir and the number of bups as param 1868 // we need the file path, the backup dir and the number of bups as param
1871 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 1869 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
1872 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 1870 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
1873 bupDir = KGlobalSettings::backupDataDir(); 1871 bupDir = KGlobalSettings::backupDataDir();
1874 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1872 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1875 if ( retval == 0 ) { 1873 if ( retval == 0 ) {
1876 setCaption(i18n("Backup cancelled" )); 1874 setCaption(i18n("Backup cancelled" ));
1877 qDebug("KO: Backup cancelled. Will try again tomorrow "); 1875 qDebug("KO: Backup cancelled. Will try again tomorrow ");
1878 // retval == 0 : backup skipped for today, try again tomorrow 1876 // retval == 0 : backup skipped for today, try again tomorrow
1879 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 1877 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
1880 } else if ( retval == 1 ){ 1878 } else if ( retval == 1 ){
1881 qDebug("KO: Backup created."); 1879 qDebug("KO: Backup created.");
1882 // backup ok 1880 // backup ok
1883 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1881 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1884 KopiCalendarFile * cal = calendars.first(); 1882 KopiCalendarFile * cal = calendars.first();
1885 cal = calendars.next(); 1883 cal = calendars.next();
1886 while ( cal ) { 1884 while ( cal ) {
1887 if ( !cal->mErrorOnLoad ) { 1885 if ( !cal->mErrorOnLoad ) {
1888 int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1886 int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1889 } 1887 }
1890 cal = calendars.next(); 1888 cal = calendars.next();
1891 } 1889 }
1892 KOPrefs::instance()->mLastBackupDate = daysTo; 1890 KOPrefs::instance()->mLastBackupDate = daysTo;
1893 setCaption(i18n("Backup succesfully finished" )); 1891 setCaption(i18n("Backup succesfully finished" ));
1894 } else if ( retval == 2 ){ 1892 } else if ( retval == 2 ){
1895 setCaption(i18n("Backup globally disabled" )); 1893 setCaption(i18n("Backup globally disabled" ));
1896 qDebug("KO: Backup globally cancelled."); 1894 qDebug("KO: Backup globally cancelled.");
1897 // backup globally cancelled 1895 // backup globally cancelled
1898 KPimGlobalPrefs::instance()->mBackupEnabled = false; 1896 KPimGlobalPrefs::instance()->mBackupEnabled = false;
1899 } 1897 }
1900 // retval == 3: do nothing, try again later 1898 // retval == 3: do nothing, try again later
1901} 1899}
1902void MainWindow::save() 1900void MainWindow::save()
1903{ 1901{
1904 if ( mView->viewManager()->journalView() ) 1902 if ( mView->viewManager()->journalView() )
1905 mView->viewManager()->journalView()->checkModified(); 1903 mView->viewManager()->journalView()->checkModified();
1906 if ( !mCalendarModifiedFlag ) { 1904 if ( !mCalendarModifiedFlag ) {
1907 qDebug("KO: Calendar not modified. Nothing saved."); 1905 qDebug("KO: Calendar not modified. Nothing saved.");
1908 return; 1906 return;
1909 } 1907 }
1910 if ( mSyncManager->blockSave() ) 1908 if ( mSyncManager->blockSave() )
1911 return; 1909 return;
1912 mSyncManager->setBlockSave(true); 1910 mSyncManager->setBlockSave(true);
1913 if ( mView->checkAllFileVersions() ) { 1911 if ( mView->checkAllFileVersions() ) {
1914 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1912 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1915 QDate reference ( 2000,1,1); 1913 QDate reference ( 2000,1,1);
1916 int daysTo = reference.daysTo ( QDate::currentDate() ); 1914 int daysTo = reference.daysTo ( QDate::currentDate() );
1917 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1915 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
1918 backupAllFiles(); 1916 backupAllFiles();
1919 } 1917 }
1920 ; // KPimGlobalPrefs::instance()->mLastBackupDate 1918 ; // KPimGlobalPrefs::instance()->mLastBackupDate
1921 } 1919 }
1922 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1920 QTime neededSaveTime = QDateTime::currentDateTime().time();
1923 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1921 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1924 qDebug("KO: Start saving data to file!"); 1922 qDebug("KO: Start saving data to file!");
1925 mView->saveCalendars(); 1923 mView->saveCalendars();
1926 mCalendarModifiedFlag = false; 1924 mCalendarModifiedFlag = false;
1927 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1925 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1928 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1926 qDebug("KO: Needed %d ms for saving.",msNeeded );
1929 QString savemes; 1927 QString savemes;
1930 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1928 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1931 setCaption(savemes); 1929 setCaption(savemes);
1932 } else 1930 } else
1933 setCaption(i18n("Saving cancelled!")); 1931 setCaption(i18n("Saving cancelled!"));
1934 mSyncManager->setBlockSave( false ); 1932 mSyncManager->setBlockSave( false );
1935} 1933}
1936 1934
1937void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1935void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1938{ 1936{
1939 if ( !e->isAutoRepeat() ) { 1937 if ( !e->isAutoRepeat() ) {
1940 mFlagKeyPressed = false; 1938 mFlagKeyPressed = false;
1941 } 1939 }
1942} 1940}
1943void MainWindow::keyPressEvent ( QKeyEvent * e ) 1941void MainWindow::keyPressEvent ( QKeyEvent * e )
1944{ 1942{
1945 qApp->processEvents(); 1943 qApp->processEvents();
1946 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1944 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1947 e->ignore(); 1945 e->ignore();
1948 // qDebug(" ignore %d",e->isAutoRepeat() ); 1946 // qDebug(" ignore %d",e->isAutoRepeat() );
1949 return; 1947 return;
1950 } 1948 }
1951 if (! e->isAutoRepeat() ) 1949 if (! e->isAutoRepeat() )
1952 mFlagKeyPressed = true; 1950 mFlagKeyPressed = true;
1953 KOPrefs *p = KOPrefs::instance(); 1951 KOPrefs *p = KOPrefs::instance();
1954 bool showSelectedDates = false; 1952 bool showSelectedDates = false;
1955 int size; 1953 int size;
1956 int pro = 0; 1954 int pro = 0;
1957 //qDebug("MainWindow::keyPressEvent "); 1955 //qDebug("MainWindow::keyPressEvent ");
1958 switch ( e->key() ) { 1956 switch ( e->key() ) {
1959 case Qt::Key_Right: 1957 case Qt::Key_Right:
1960 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1958 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1961 mView->goNextMonth(); 1959 mView->goNextMonth();
1962 else 1960 else
1963 mView->goNext(); 1961 mView->goNext();
1964 showSelectedDates = true; 1962 showSelectedDates = true;
1965 break; 1963 break;
1966 case Qt::Key_Left: 1964 case Qt::Key_Left:
1967 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1965 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1968 mView->goPreviousMonth(); 1966 mView->goPreviousMonth();
1969 else 1967 else
1970 mView->goPrevious(); 1968 mView->goPrevious();
1971 showSelectedDates = true; 1969 showSelectedDates = true;
1972 break; 1970 break;
1973 case Qt::Key_Down: 1971 case Qt::Key_Down:
1974 mView->viewManager()->agendaView()->scrollOneHourDown(); 1972 mView->viewManager()->agendaView()->scrollOneHourDown();
1975 break; 1973 break;
1976 case Qt::Key_Up: 1974 case Qt::Key_Up:
1977 mView->viewManager()->agendaView()->scrollOneHourUp(); 1975 mView->viewManager()->agendaView()->scrollOneHourUp();
1978 break; 1976 break;
1979 case Qt::Key_K: 1977 case Qt::Key_K:
1980 mView->viewManager()->showMonthViewWeek(); 1978 mView->viewManager()->showMonthViewWeek();
1981 break; 1979 break;
1982 case Qt::Key_I: 1980 case Qt::Key_I:
1983 mView->showIncidence(); 1981 mView->showIncidence();
1984 break; 1982 break;
1985 case Qt::Key_Delete: 1983 case Qt::Key_Delete:
1986 case Qt::Key_Backspace: 1984 case Qt::Key_Backspace:
1987 mView->deleteIncidence(); 1985 mView->deleteIncidence();
1988 break; 1986 break;
1989 case Qt::Key_D: 1987 case Qt::Key_D:
1990 mView->viewManager()->showDayView(); 1988 mView->viewManager()->showDayView();
1991 showSelectedDates = true; 1989 showSelectedDates = true;
1992 break; 1990 break;
1993 case Qt::Key_O: 1991 case Qt::Key_O:
1994 mView->toggleFilerEnabled( ); 1992 mView->toggleFilerEnabled( );
1995 break; 1993 break;
1996 case Qt::Key_0: 1994 case Qt::Key_0:
1997 case Qt::Key_1: 1995 case Qt::Key_1:
1998 case Qt::Key_2: 1996 case Qt::Key_2:
1999 case Qt::Key_3: 1997 case Qt::Key_3:
2000 case Qt::Key_4: 1998 case Qt::Key_4:
2001 case Qt::Key_5: 1999 case Qt::Key_5:
2002 case Qt::Key_6: 2000 case Qt::Key_6:
2003 case Qt::Key_7: 2001 case Qt::Key_7:
2004 case Qt::Key_8: 2002 case Qt::Key_8:
2005 case Qt::Key_9: 2003 case Qt::Key_9:
2006 pro = e->key()-48; 2004 pro = e->key()-48;
2007 if ( pro == 0 ) 2005 if ( pro == 0 )
2008 pro = 10; 2006 pro = 10;
2009 if ( e->state() == Qt::ControlButton) 2007 if ( e->state() == Qt::ControlButton)
2010 pro += 10; 2008 pro += 10;
2011 break; 2009 break;
2012 case Qt::Key_M: 2010 case Qt::Key_M:
2013 mView->viewManager()->showMonthView(); 2011 mView->viewManager()->showMonthView();
2014 showSelectedDates = true; 2012 showSelectedDates = true;
2015 break; 2013 break;
2016 case Qt::Key_Insert: 2014 case Qt::Key_Insert:
2017 mView->newEvent(); 2015 mView->newEvent();
2018 break; 2016 break;
2019 case Qt::Key_S : 2017 case Qt::Key_S :
2020 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 2018 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
2021 mView->newSubTodo(); 2019 mView->newSubTodo();
2022 else 2020 else
2023 mView->dialogManager()->showSearchDialog(); 2021 mView->dialogManager()->showSearchDialog();
2024 break; 2022 break;
2025 case Qt::Key_Y : 2023 case Qt::Key_Y :
2026 case Qt::Key_Z : 2024 case Qt::Key_Z :
2027 mView->viewManager()->showWorkWeekView(); 2025 mView->viewManager()->showWorkWeekView();
2028 showSelectedDates = true; 2026 showSelectedDates = true;
2029 break; 2027 break;
2030 case Qt::Key_U : 2028 case Qt::Key_U :
2031 mView->viewManager()->showWeekView(); 2029 mView->viewManager()->showWeekView();
2032 showSelectedDates = true; 2030 showSelectedDates = true;
2033 break; 2031 break;
2034 case Qt::Key_H : 2032 case Qt::Key_H :
2035 keyBindings(); 2033 keyBindings();
2036 break; 2034 break;
2037 case Qt::Key_W: 2035 case Qt::Key_W:
2038 mView->viewManager()->showWhatsNextView(); 2036 mView->viewManager()->showWhatsNextView();
2039 break; 2037 break;
2040 case Qt::Key_L: 2038 case Qt::Key_L:
2041 mView->viewManager()->showListView(); 2039 mView->viewManager()->showListView();
2042 break; 2040 break;
2043 case Qt::Key_N: 2041 case Qt::Key_N:
2044 mView->viewManager()->showNextView(); 2042 mView->viewManager()->showNextView();
2045 break; 2043 break;
2046 case Qt::Key_V: 2044 case Qt::Key_V:
2047 mView->viewManager()->showTodoView(); 2045 mView->viewManager()->showTodoView();
2048 break; 2046 break;
2049 case Qt::Key_C: 2047 case Qt::Key_C:
2050 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 2048 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
2051 break; 2049 break;
2052 case Qt::Key_P: 2050 case Qt::Key_P:
2053 mView->showDatePicker( ); 2051 mView->showDatePicker( );
2054 break; 2052 break;
2055 case Qt::Key_F: 2053 case Qt::Key_F:
2056 mView->editFilters(); 2054 mView->editFilters();
2057 break; 2055 break;
2058 case Qt::Key_R: 2056 case Qt::Key_R:
2059 mView->toggleFilter(); 2057 mView->toggleFilter();
2060 break; 2058 break;
2061 case Qt::Key_X: 2059 case Qt::Key_X:
2062 if ( e->state() == Qt::ControlButton ) 2060 if ( e->state() == Qt::ControlButton )
2063 mView->toggleDateNavigatorWidget(); 2061 mView->toggleDateNavigatorWidget();
2064 else { 2062 else {
2065 mView->viewManager()->showNextXView(); 2063 mView->viewManager()->showNextXView();
2066 showSelectedDates = true; 2064 showSelectedDates = true;
2067 } 2065 }
2068 break; 2066 break;
2069 case Qt::Key_Space: 2067 case Qt::Key_Space:
2070 mView->toggleExpand(); 2068 mView->toggleExpand();
2071 break; 2069 break;
2072 case Qt::Key_A: 2070 case Qt::Key_A:
2073 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 2071 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
2074 mView->showNextAlarms(); 2072 mView->showNextAlarms();
2075 else 2073 else
2076 mView->toggleAllDaySize(); 2074 mView->toggleAllDaySize();
2077 break; 2075 break;
2078 case Qt::Key_T: 2076 case Qt::Key_T:
2079 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2077 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2080 mView->newTodo(); 2078 mView->newTodo();
2081 else { 2079 else {
2082 mView->goToday(); 2080 mView->goToday();
2083 showSelectedDates = true; 2081 showSelectedDates = true;
2084 } 2082 }
2085 break; 2083 break;
2086 case Qt::Key_J: 2084 case Qt::Key_J:
2087 mView->viewManager()->showJournalView(); 2085 mView->viewManager()->showJournalView();
2088 break; 2086 break;
2089 case Qt::Key_B: 2087 case Qt::Key_B:
2090 mView->editIncidenceDescription();; 2088 mView->editIncidenceDescription();;
2091 break; 2089 break;
2092 // case Qt::Key_Return: 2090 // case Qt::Key_Return:
2093 case Qt::Key_E: 2091 case Qt::Key_E:
2094 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2092 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2095 mView->newEvent(); 2093 mView->newEvent();
2096 else 2094 else
2097 mView->editIncidence(); 2095 mView->editIncidence();
2098 break; 2096 break;
2099 case Qt::Key_Plus: 2097 case Qt::Key_Plus:
2100 size = p->mHourSize +2; 2098 size = p->mHourSize +2;
2101 if ( size <= 22 ) 2099 if ( size <= 22 )
2102 configureAgenda( size ); 2100 configureAgenda( size );
2103 break; 2101 break;
2104 case Qt::Key_Minus: 2102 case Qt::Key_Minus:
2105 size = p->mHourSize - 2; 2103 size = p->mHourSize - 2;
2106 if ( size >= 4 ) 2104 if ( size >= 4 )
2107 configureAgenda( size ); 2105 configureAgenda( size );
2108 break; 2106 break;
2109 2107
2110 2108
2111 default: 2109 default:
2112 e->ignore(); 2110 e->ignore();
2113 } 2111 }
2114 if ( pro > 0 ) { 2112 if ( pro > 0 ) {
2115 selectFilter( pro+1 ); 2113 selectFilter( pro+1 );
2116 } 2114 }
2117 if ( showSelectedDates ) { 2115 if ( showSelectedDates ) {
2118 ;// setCaptionToDates(); 2116 ;// setCaptionToDates();
2119 } 2117 }
2120 2118
2121} 2119}
2122void MainWindow::fillFilterMenuTB() 2120void MainWindow::fillFilterMenuTB()
2123{ 2121{
2124 selectFilterMenuTB->clear(); 2122 selectFilterMenuTB->clear();
2125 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 2123 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
2126 selectFilterMenuTB->insertSeparator(); 2124 selectFilterMenuTB->insertSeparator();
2127 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 2125 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
2128 2126
2129 selectFilterMenuTB->insertSeparator(); 2127 selectFilterMenuTB->insertSeparator();
2130 QPtrList<CalFilter> fili = mView->filters(); 2128 QPtrList<CalFilter> fili = mView->filters();
2131 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2129 CalFilter *curfilter = mView->filterView()->selectedFilter();
2132 CalFilter *filter = fili.first(); 2130 CalFilter *filter = fili.first();
2133 int iii = 2; 2131 int iii = 2;
2134 bool checkitem = mView->filterView()->filtersEnabled(); 2132 bool checkitem = mView->filterView()->filtersEnabled();
2135 while(filter) { 2133 while(filter) {
2136 selectFilterMenuTB->insertItem( filter->name(), iii ); 2134 selectFilterMenuTB->insertItem( filter->name(), iii );
2137 if ( filter == curfilter) 2135 if ( filter == curfilter)
2138 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2136 selectFilterMenuTB->setItemChecked( iii, checkitem );
2139 filter = fili.next(); 2137 filter = fili.next();
2140 ++iii; 2138 ++iii;
2141 } 2139 }
2142 if ( !checkitem ) 2140 if ( !checkitem )
2143 selectFilterMenuTB->setItemChecked( 1, true ); 2141 selectFilterMenuTB->setItemChecked( 1, true );
2144 2142
2145 int x = 0; 2143 int x = 0;
2146 int y = iconToolBar->height(); 2144 int y = iconToolBar->height();
2147 int dX = 0; 2145 int dX = 0;
2148 int dY = 0; 2146 int dY = 0;
2149 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2147 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2150 if ( iconToolBar->y() > height()/2 ) { 2148 if ( iconToolBar->y() > height()/2 ) {
2151 dY = selectFilterMenuTB->sizeHint().height()+8; 2149 dY = selectFilterMenuTB->sizeHint().height()+8;
2152 y = 0; 2150 y = 0;
2153 } 2151 }
2154 } else { 2152 } else {
2155 if ( iconToolBar->x() > width()/2 ) { // right side 2153 if ( iconToolBar->x() > width()/2 ) { // right side
2156 x=0; 2154 x=0;
2157 dX= selectFilterMenuTB->sizeHint().width()+8; 2155 dX= selectFilterMenuTB->sizeHint().width()+8;
2158 y = 0; 2156 y = 0;
2159 } else { 2157 } else {
2160 x= iconToolBar->width(); 2158 x= iconToolBar->width();
2161 y = 0; 2159 y = 0;
2162 } 2160 }
2163 } 2161 }
2164 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2162 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2165 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2163 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2166} 2164}
2167void MainWindow::fillFilterMenu() 2165void MainWindow::fillFilterMenu()
2168{ 2166{
2169 selectFilterMenu->clear(); 2167 selectFilterMenu->clear();
2170 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2168 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2171 selectFilterMenu->insertSeparator(); 2169 selectFilterMenu->insertSeparator();
2172 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2170 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2173 2171
2174 selectFilterMenu->insertSeparator(); 2172 selectFilterMenu->insertSeparator();
2175 QPtrList<CalFilter> fili = mView->filters(); 2173 QPtrList<CalFilter> fili = mView->filters();
2176 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2174 CalFilter *curfilter = mView->filterView()->selectedFilter();
2177 CalFilter *filter = fili.first(); 2175 CalFilter *filter = fili.first();
2178 int iii = 2; 2176 int iii = 2;
2179 bool checkitem = mView->filterView()->filtersEnabled(); 2177 bool checkitem = mView->filterView()->filtersEnabled();
2180 while(filter) { 2178 while(filter) {
2181 selectFilterMenu->insertItem( filter->name(), iii ); 2179 selectFilterMenu->insertItem( filter->name(), iii );
2182 if ( filter == curfilter) 2180 if ( filter == curfilter)
2183 selectFilterMenu->setItemChecked( iii, checkitem ); 2181 selectFilterMenu->setItemChecked( iii, checkitem );
2184 filter = fili.next(); 2182 filter = fili.next();
2185 ++iii; 2183 ++iii;
2186 } 2184 }
2187 if ( !checkitem ) 2185 if ( !checkitem )
2188 selectFilterMenu->setItemChecked( 1, true ); 2186 selectFilterMenu->setItemChecked( 1, true );
2189} 2187}
2190void MainWindow::fillFilterMenuPopup() 2188void MainWindow::fillFilterMenuPopup()
2191{ 2189{
2192 filterPopupMenu->clear(); 2190 filterPopupMenu->clear();
2193 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2191 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2194 2192
2195 filterPopupMenu->insertSeparator(); 2193 filterPopupMenu->insertSeparator();
2196 QPtrList<CalFilter> fili = mView->filters(); 2194 QPtrList<CalFilter> fili = mView->filters();
2197 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2195 CalFilter *curfilter = mView->filterView()->selectedFilter();
2198 CalFilter *filter = fili.first(); 2196 CalFilter *filter = fili.first();
2199 int iii = 1; 2197 int iii = 1;
2200 bool checkitem = mView->filterView()->filtersEnabled(); 2198 bool checkitem = mView->filterView()->filtersEnabled();
2201 while(filter) { 2199 while(filter) {
2202 filterPopupMenu->insertItem( filter->name(), iii ); 2200 filterPopupMenu->insertItem( filter->name(), iii );
2203 if ( filter == curfilter) 2201 if ( filter == curfilter)
2204 filterPopupMenu->setItemChecked( iii, checkitem ); 2202 filterPopupMenu->setItemChecked( iii, checkitem );
2205 filter = fili.next(); 2203 filter = fili.next();
2206 ++iii; 2204 ++iii;
2207 } 2205 }
2208 if ( !checkitem ) 2206 if ( !checkitem )
2209 filterPopupMenu->setItemChecked( 0, true ); 2207 filterPopupMenu->setItemChecked( 0, true );
2210} 2208}
2211void MainWindow::selectFilter( int fil ) 2209void MainWindow::selectFilter( int fil )
2212{ 2210{
2213 2211
2214 if ( fil == 0 ) { 2212 if ( fil == 0 ) {
2215 mView->editFilters( ); 2213 mView->editFilters( );
2216 } else if ( fil == 1 ){ 2214 } else if ( fil == 1 ){
2217 if ( mView->filterView()->filtersEnabled() ) 2215 if ( mView->filterView()->filtersEnabled() )
2218 mView->toggleFilerEnabled( ); 2216 mView->toggleFilerEnabled( );
2219 } else { 2217 } else {
2220 if ( !mView->filterView()->filtersEnabled() ) { 2218 if ( !mView->filterView()->filtersEnabled() ) {
2221 mView->filterView()->blockSignals( true ); 2219 mView->filterView()->blockSignals( true );
2222 mView->toggleFilerEnabled( ); 2220 mView->toggleFilerEnabled( );
2223 mView->filterView()->blockSignals( false ); 2221 mView->filterView()->blockSignals( false );
2224 } 2222 }
2225 mView->selectFilter( fil-2 ); 2223 mView->selectFilter( fil-2 );
2226 } 2224 }
2227} 2225}
2228void MainWindow::updateFilterToolbar() 2226void MainWindow::updateFilterToolbar()
2229{ 2227{
2230 if ( filterMenubar ) { 2228 if ( filterMenubar ) {
2231 if ( !mView->filterView()->filtersEnabled() ) { 2229 if ( !mView->filterView()->filtersEnabled() ) {
2232 filterMenubar->changeItem( 0, i18n("No Filter") ); 2230 filterMenubar->changeItem( 0, i18n("No Filter") );
2233 } else { 2231 } else {
2234 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2232 CalFilter *curfilter = mView->filterView()->selectedFilter();
2235 if ( curfilter ) { 2233 if ( curfilter ) {
2236 filterMenubar->changeItem( 0, curfilter->name() ); 2234 filterMenubar->changeItem( 0, curfilter->name() );
2237 } 2235 }
2238 } 2236 }
2239 } 2237 }
2240} 2238}
2241void MainWindow::selectFilterPopup( int fil ) 2239void MainWindow::selectFilterPopup( int fil )
2242{ 2240{
2243 selectFilter( fil + 1 ); 2241 selectFilter( fil + 1 );
2244 2242
2245} 2243}
2246void MainWindow::configureToolBar( int item ) 2244void MainWindow::configureToolBar( int item )
2247{ 2245{
2248 2246
2249 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2247 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2250 KOPrefs *p = KOPrefs::instance(); 2248 KOPrefs *p = KOPrefs::instance();
2251 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2249 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2252 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2250 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2253 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2251 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2254 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2252 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2255 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2253 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2256 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2254 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2257 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2255 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2258 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2256 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2259 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2257 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2260 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2258 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2261 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2259 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2262 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2260 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2263 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2261 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2264 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2262 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2265 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2263 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2266 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2264 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2267 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2265 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2268 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2266 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2269 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2267 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2270 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2268 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2271 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2269 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2272 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2270 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2273 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2271 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2274 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2272 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2275 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2273 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2276 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2274 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2277 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2275 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2278 // initActions(); 2276 // initActions();
2279} 2277}
2280void MainWindow::setCaption ( const QString & c ) 2278void MainWindow::setCaption ( const QString & c )
2281{ 2279{
2282 QString cap = c; 2280 QString cap = c;
2283 cap.replace( QRegExp("\n"), " " ); 2281 cap.replace( QRegExp("\n"), " " );
2284 cap = cap.stripWhiteSpace(); 2282 cap = cap.stripWhiteSpace();
2285 if ( cap.isEmpty() ) 2283 if ( cap.isEmpty() )
2286 cap = "KO/Pi"; 2284 cap = "KO/Pi";
2287 QWidget::setCaption( cap ); 2285 QWidget::setCaption( cap );
2288} 2286}
2289void MainWindow::setCaptionToDates() 2287void MainWindow::setCaptionToDates()
2290{ 2288{
2291 QString selDates; 2289 QString selDates;
2292 QDate date = mView->startDate(); 2290 QDate date = mView->startDate();
2293 if ( ! date.isValid() ) { 2291 if ( ! date.isValid() ) {
2294 setCaption(""); 2292 setCaption("");
2295 return; 2293 return;
2296 } 2294 }
2297 selDates = KGlobal::locale()->formatDate( date, true); 2295 selDates = KGlobal::locale()->formatDate( date, true);
2298 if (mView->startDate() < mView->endDate() ) 2296 if (mView->startDate() < mView->endDate() )
2299 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2297 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2300 else { 2298 else {
2301 QString addString; 2299 QString addString;
2302 if ( date == QDateTime::currentDateTime().date() ) 2300 if ( date == QDateTime::currentDateTime().date() )
2303 addString = i18n("Today"); 2301 addString = i18n("Today");
2304 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2302 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2305 addString = i18n("Tomorrow"); 2303 addString = i18n("Tomorrow");
2306 if ( !addString.isEmpty() ) 2304 if ( !addString.isEmpty() )
2307 selDates = addString+", "+selDates ; 2305 selDates = addString+", "+selDates ;
2308 } 2306 }
2309 setCaption( i18n("Dates: ") + selDates ); 2307 setCaption( i18n("Dates: ") + selDates );
2310 2308
2311} 2309}
2312void MainWindow::showConfigureAgenda( ) 2310void MainWindow::showConfigureAgenda( )
2313{ 2311{
2314 int iii; 2312 int iii;
2315 for ( iii = 1;iii<= 10 ;++iii ){ 2313 for ( iii = 1;iii<= 10 ;++iii ){
2316 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2314 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2317 } 2315 }
2318 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2316 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2319} 2317}
2320void MainWindow::configureAgenda( int item ) 2318void MainWindow::configureAgenda( int item )
2321{ 2319{
2322 if ( KOPrefs::instance()->mHourSize == item ) 2320 if ( KOPrefs::instance()->mHourSize == item )
2323 return; 2321 return;
2324 KOPrefs::instance()->mHourSize=item; 2322 KOPrefs::instance()->mHourSize=item;
2325 mView->viewManager()->agendaView()->updateConfig(); 2323 mView->viewManager()->agendaView()->updateConfig();
2326} 2324}
2327 2325
2328void MainWindow::saveCalendar() 2326void MainWindow::saveCalendar()
2329{ 2327{
2330 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 2328 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
2331 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 2329 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
2332 bupDir = KGlobalSettings::backupDataDir(); 2330 bupDir = KGlobalSettings::backupDataDir();
2333 bupDir = KGlobal::formatMessage ( bupDir, 0 ); 2331 bupDir = KGlobal::formatMessage ( bupDir, 0 );
2334 QString bupHint; 2332 QString bupHint;
2335 if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) 2333 if ( !KPimGlobalPrefs::instance()->mBackupEnabled )
2336 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); 2334 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)");
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; 2335 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;
2338 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; 2336 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled;
2339 KPimGlobalPrefs::instance()->mBackupEnabled = false; 2337 KPimGlobalPrefs::instance()->mBackupEnabled = false;
2340 save(); 2338 save();
2341 KPimGlobalPrefs::instance()->mBackupEnabled = enabled; 2339 KPimGlobalPrefs::instance()->mBackupEnabled = enabled;
2342 backupAllFiles(); 2340 backupAllFiles();
2343} 2341}
2344void MainWindow::loadCalendar() 2342void MainWindow::loadCalendar()
2345{ 2343{
2346 2344
2347 2345
2348#if 0 2346#if 0
2349 QString fn = KOPrefs::instance()->mLastLoadFile; 2347 QString fn = KOPrefs::instance()->mLastLoadFile;
2350 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2348 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2351 2349
2352 if ( fn == "" ) 2350 if ( fn == "" )
2353 return; 2351 return;
2354 QFileInfo info; 2352 QFileInfo info;
2355 info.setFile( fn ); 2353 info.setFile( fn );
2356 QString mess; 2354 QString mess;
2357 bool loadbup = true; 2355 bool loadbup = true;
2358 if ( info. exists() ) { 2356 if ( info. exists() ) {
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 )); 2357 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2360 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2358 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2361 mess, 2359 mess,
2362 i18n("Load!"), i18n("Cancel"), 0, 2360 i18n("Load!"), i18n("Cancel"), 0,
2363 0, 1 ); 2361 0, 1 );
2364 if ( result != 0 ) { 2362 if ( result != 0 ) {
2365 loadbup = false; 2363 loadbup = false;
2366 } 2364 }
2367 } else { 2365 } else {
2368 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2366 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2369 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2367 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2370 0, 1 ); 2368 0, 1 );
2371 2369
2372 return; 2370 return;
2373 } 2371 }
2374 if ( loadbup ) { 2372 if ( loadbup ) {
2375 mView->openCalendar( fn ); 2373 mView->openCalendar( fn );
2376 KOPrefs::instance()->mLastLoadFile = fn; 2374 KOPrefs::instance()->mLastLoadFile = fn;
2377 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2375 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2378 setCaption(mess); 2376 setCaption(mess);
2379 } 2377 }
2380#endif 2378#endif
2381 2379
2382} 2380}
2383void MainWindow::quickImportIcal() 2381void MainWindow::quickImportIcal()
2384{ 2382{
2385 importFile( KOPrefs::instance()->mLastImportFile, false ); 2383 importFile( KOPrefs::instance()->mLastImportFile, false );
2386} 2384}
2387void MainWindow::importFile( QString fn, bool quick ) 2385void MainWindow::importFile( QString fn, bool quick )
2388{ 2386{
2389 QFileInfo info; 2387 QFileInfo info;
2390 info.setFile( fn ); 2388 info.setFile( fn );
2391 QString mess; 2389 QString mess;
2392 bool loadbup = true; 2390 bool loadbup = true;
2393 if ( !info. exists() ) { 2391 if ( !info. exists() ) {
2394 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2392 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2395 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2393 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2396 mess ); 2394 mess );
2397 return; 2395 return;
2398 } 2396 }
2399 int result = 0; 2397 int result = 0;
2400 if ( !quick ) { 2398 if ( !quick ) {
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 )); 2399 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 ));
2402 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2400 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2403 mess, 2401 mess,
2404 "Import", "Cancel", 0, 2402 "Import", "Cancel", 0,
2405 0, 1 ); 2403 0, 1 );
2406 } 2404 }
2407 if ( result == 0 ) { 2405 if ( result == 0 ) {
2408 if ( mView->openCalendar( fn, true )) { 2406 if ( mView->openCalendar( fn, true )) {
2409 KOPrefs::instance()->mLastImportFile = fn; 2407 KOPrefs::instance()->mLastImportFile = fn;
2410 setCaption(i18n("Imported file successfully")); 2408 setCaption(i18n("Imported file successfully"));
2411 } else { 2409 } else {
2412 setCaption(i18n("Error importing file")); 2410 setCaption(i18n("Error importing file"));
2413 } 2411 }
2414 } 2412 }
2415} 2413}
2416 2414
2417void MainWindow::importIcal() 2415void MainWindow::importIcal()
2418{ 2416{
2419 2417
2420 QString fn =KOPrefs::instance()->mLastImportFile; 2418 QString fn =KOPrefs::instance()->mLastImportFile;
2421 2419
2422 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2420 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2423 if ( fn == "" ) 2421 if ( fn == "" )
2424 return; 2422 return;
2425 importFile( fn, true ); 2423 importFile( fn, true );
2426 2424
2427} 2425}
2428 2426
2429void MainWindow::exportVCalendar() 2427void MainWindow::exportVCalendar()
2430{ 2428{
2431 QString fn = KOPrefs::instance()->mLastVcalFile; 2429 QString fn = KOPrefs::instance()->mLastVcalFile;
2432 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2430 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2433 if ( fn == "" ) 2431 if ( fn == "" )
2434 return; 2432 return;
2435 QFileInfo info; 2433 QFileInfo info;
2436 info.setFile( fn ); 2434 info.setFile( fn );
2437 QString mes; 2435 QString mes;
2438 bool createbup = true; 2436 bool createbup = true;
2439 if ( info. exists() ) { 2437 if ( info. exists() ) {
2440 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2438 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2441 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2439 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2442 i18n("Overwrite!"), i18n("Cancel"), 0, 2440 i18n("Overwrite!"), i18n("Cancel"), 0,
2443 0, 1 ); 2441 0, 1 );
2444 if ( result != 0 ) { 2442 if ( result != 0 ) {
2445 createbup = false; 2443 createbup = false;
2446 } 2444 }
2447 } 2445 }
2448 if ( createbup ) { 2446 if ( createbup ) {
2449 if ( mView->exportVCalendar( fn ) ) { 2447 if ( mView->exportVCalendar( fn ) ) {
2450 KOPrefs::instance()->mLastVcalFile = fn; 2448 KOPrefs::instance()->mLastVcalFile = fn;
2451 if ( fn.length() > 20 ) 2449 if ( fn.length() > 20 )
2452 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2450 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2453 else 2451 else
2454 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2452 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2455 setCaption(mes); 2453 setCaption(mes);
2456 } 2454 }
2457 } 2455 }
2458 2456
2459} 2457}
2460QString MainWindow::sentSyncFile() 2458QString MainWindow::sentSyncFile()
2461{ 2459{
2462#ifdef DESKTOP_VERSION 2460#ifdef DESKTOP_VERSION
2463 return locateLocal( "tmp", "copysynccal.ics" ); 2461 return locateLocal( "tmp", "copysynccal.ics" );
2464#else 2462#else
2465 return QString( "/tmp/copysynccal.ics" ); 2463 return QString( "/tmp/copysynccal.ics" );
2466#endif 2464#endif
2467} 2465}
2468 2466
2469void MainWindow::syncFileRequest() 2467void MainWindow::syncFileRequest()
2470{ 2468{
2471 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2469 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2472 mSyncManager->slotSyncMenu( 999 ); 2470 mSyncManager->slotSyncMenu( 999 );
2473 } 2471 }
2474 2472
2475 setCaption(i18n("Saving Data to temp file ..." )); 2473 setCaption(i18n("Saving Data to temp file ..." ));
2476 mView->saveCalendar( sentSyncFile() ); 2474 mView->saveCalendar( sentSyncFile() );
2477 setCaption(i18n("Data saved to temp file!" )); 2475 setCaption(i18n("Data saved to temp file!" ));
2478 2476
2479} 2477}
2480void MainWindow::getFile( bool success ) 2478void MainWindow::getFile( bool success )
2481{ 2479{
2482 if ( ! success ) { 2480 if ( ! success ) {
2483 setCaption( i18n("Error receiving file. Nothing changed!") ); 2481 setCaption( i18n("Error receiving file. Nothing changed!") );
2484 return; 2482 return;
2485 } 2483 }
2486 mView->openCalendar( sentSyncFile() ); 2484 mView->openCalendar( sentSyncFile() );
2487 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2485 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2488 mSyncManager->slotSyncMenu( 999 ); 2486 mSyncManager->slotSyncMenu( 999 );
2489 } 2487 }
2490 setCaption( i18n("Pi-Sync successful!") ); 2488 setCaption( i18n("Pi-Sync successful!") );
2491} 2489}
2492void MainWindow::printListView() 2490void MainWindow::printListView()
2493{ 2491{
2494 2492
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."); 2493 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.");
2496 2494
2497 KMessageBox::information( this, message); 2495 KMessageBox::information( this, message);
2498} 2496}
2499void MainWindow::printSel( ) 2497void MainWindow::printSel( )
2500{ 2498{
2501 mView->viewManager()->agendaView()->agenda()->printSelection(); 2499 mView->viewManager()->agendaView()->agenda()->printSelection();
2502} 2500}
2503 2501
2504void MainWindow::printCal() 2502void MainWindow::printCal()
2505{ 2503{
2506 mView->print();//mCp->showDialog(); 2504 mView->print();//mCp->showDialog();
2507} 2505}
2508 2506
2509 2507
2510#include "libkdepim/kdatepicker.h" 2508#include "libkdepim/kdatepicker.h"
2511#include <kdatetbl.h> 2509#include <kdatetbl.h>
2512 2510
2513void MainWindow::weekAction() 2511void MainWindow::weekAction()
2514{ 2512{
2515 int month; 2513 int month;
2516 KPopupFrame* popup = new KPopupFrame(this); 2514 KPopupFrame* popup = new KPopupFrame(this);
2517 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2515 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2518 // ----- 2516 // -----
2519 picker->resize(picker->sizeHint()); 2517 picker->resize(picker->sizeHint());
2520 popup->setMainWidget(picker); 2518 popup->setMainWidget(picker);
2521 picker->setFocus(); 2519 picker->setFocus();
2522 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2520 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2523 int x = 0; 2521 int x = 0;
2524 int y = iconToolBar->height(); 2522 int y = iconToolBar->height();
2525 int dX = 0; 2523 int dX = 0;
2526 int dY = 0; 2524 int dY = 0;
2527 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2525 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2528 if ( iconToolBar->y() > height()/2 ) { 2526 if ( iconToolBar->y() > height()/2 ) {
2529 dY = picker->sizeHint().height()+8; 2527 dY = picker->sizeHint().height()+8;
2530 y = 0; 2528 y = 0;
2531 } 2529 }
2532 } else { 2530 } else {
2533 if ( iconToolBar->x() > width()/2 ) { // right side 2531 if ( iconToolBar->x() > width()/2 ) { // right side
2534 x=0; 2532 x=0;
2535 dX= picker->sizeHint().width()+8; 2533 dX= picker->sizeHint().width()+8;
2536 y = 0; 2534 y = 0;
2537 } else { 2535 } else {
2538 x= iconToolBar->width(); 2536 x= iconToolBar->width();
2539 y = 0; 2537 y = 0;
2540 } 2538 }
2541 } 2539 }
2542 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2540 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2543 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2541 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2544 { 2542 {
2545 month = picker->getResult(); 2543 month = picker->getResult();
2546 emit selectWeek ( month ); 2544 emit selectWeek ( month );
2547 //qDebug("weekSelected %d ", month); 2545 //qDebug("weekSelected %d ", month);
2548 } 2546 }
2549 delete popup; 2547 delete popup;
2550} 2548}
2551 2549
2552void MainWindow::hideEvent ( QHideEvent * ) 2550void MainWindow::hideEvent ( QHideEvent * )
2553{ 2551{
2554 QString message; 2552 QString message;
2555 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2553 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2556 if ( nextA.isValid() ) { 2554 if ( nextA.isValid() ) {
2557 QString sum = mCalendar->nextSummary(); 2555 QString sum = mCalendar->nextSummary();
2558 2556
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)); 2557 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));
2560 setCaption( message ); 2558 setCaption( message );
2561 } 2559 }
2562} 2560}
2563 2561
2564void MainWindow::resizeEvent( QResizeEvent* e) 2562void MainWindow::resizeEvent( QResizeEvent* e)
2565{ 2563{
2566#ifndef DESKTOP_VERSION 2564#ifndef DESKTOP_VERSION
2567 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { 2565 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2568 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2566 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2569 filterToolBar->hide(); 2567 filterToolBar->hide();
2570 else 2568 else
2571 filterToolBar->show(); 2569 filterToolBar->show();
2572 } 2570 }
2573#endif 2571#endif
2574 QMainWindow::resizeEvent( e); 2572 QMainWindow::resizeEvent( e);
2575} 2573}