summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-16 20:11:20 (UTC)
committer zautrix <zautrix>2005-03-16 20:11:20 (UTC)
commitaae23f2f26ef87a4fe45ea54f1e7fe82e9fd0460 (patch) (unidiff)
treec90a533233c8a9c4c8a0be69391bae2c8dd52c50 /korganizer
parent03eea81694e8956a16b71bb3e9647c20383adb71 (diff)
downloadkdepimpi-aae23f2f26ef87a4fe45ea54f1e7fe82e9fd0460.zip
kdepimpi-aae23f2f26ef87a4fe45ea54f1e7fe82e9fd0460.tar.gz
kdepimpi-aae23f2f26ef87a4fe45ea54f1e7fe82e9fd0460.tar.bz2
fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolocationbox.cpp2
-rw-r--r--korganizer/kolocationbox.h2
-rw-r--r--korganizer/mainwindow.cpp4
3 files changed, 4 insertions, 4 deletions
diff --git a/korganizer/kolocationbox.cpp b/korganizer/kolocationbox.cpp
index f8fee2e..35a8123 100644
--- a/korganizer/kolocationbox.cpp
+++ b/korganizer/kolocationbox.cpp
@@ -1,96 +1,96 @@
1/* 1/*
2 Copyright (c) 2004 Dirk Loesche <dirk.loesche@bigfoot.de> 2 Copyright (c) 2004 Dirk Loesche <dirk.loesche@bigfoot.de>
3 3
4 This file is part of KOrganizer/PI 4 This file is part of KOrganizer/PI
5 KOrganizer Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 5 KOrganizer Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
6 KOrganizer/PI Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net> 6 KOrganizer/PI Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or 10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version. 11 (at your option) any later version.
12 12
13 This program is distributed in the hope that it will be useful, 13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 21
22 As a special exception, permission is given to link this program 22 As a special exception, permission is given to link this program
23 with any edition of Qt, and distribute the resulting executable, 23 with any edition of Qt, and distribute the resulting executable,
24 without including the source code for Qt in the source distribution. 24 without including the source code for Qt in the source distribution.
25*/ 25*/
26 26
27#include "kolocationbox.h" 27#include "kolocationbox.h"
28#include <qstring.h> 28#include <qstring.h>
29#include <qlineedit.h> 29#include <qlineedit.h>
30#include <qapplication.h> 30#include <qapplication.h>
31 31
32 32
33KOLocationBox::KOLocationBox( bool rw , QWidget *parent , int _maxItems) : 33KOLocationBox::KOLocationBox( bool rw , QWidget *parent , int _maxItems) :
34 QComboBox( rw , parent ) 34 QComboBox( rw , parent )
35{ 35{
36 maxItems = _maxItems; 36 maxItems = _maxItems;
37 maxItems = 50; // sorry - hack from me to set maxitems globally to 30 37 maxItems = 50; // sorry - hack from me to set maxitems globally to 30
38 setInsertionPolicy(AtTop); 38 setInsertionPolicy(AtTop);
39 setDuplicatesEnabled( FALSE ); 39 setDuplicatesEnabled( FALSE );
40 setMaxCount( maxItems ); 40 setMaxCount( maxItems );
41 setAutoCompletion( TRUE ); 41 setAutoCompletion( TRUE );
42 42
43} 43}
44 44
45KOLocationBox::~KOLocationBox() 45KOLocationBox::~KOLocationBox()
46{ 46{
47} 47}
48 48
49void KOLocationBox::load(int what) 49void KOLocationBox::load(int what)
50{ 50{
51 clear(); 51 clear();
52 // qDebug("load %d ",what ); 52 // qDebug("load %d ",what );
53 switch(what) { 53 switch(what) {
54 case LOCATION: 54 case LOCATION:
55 insertStringList( KOPrefs::instance()->mLocationDefaults, 0 ); 55 insertStringList( KOPrefs::instance()->mLocationDefaults, 0 );
56// insertStringList( KOPrefs::instance()->mLocationUserDefaults, 0 ); 56// insertStringList( KOPrefs::instance()->mLocationUserDefaults, 0 );
57 break; // don't disable 57 break; // don't disable
58 case SUMMARYEVENT: 58 case SUMMARYEVENT:
59 insertStringList( KOPrefs::instance()->mEventSummaryUser, 0 ); 59 insertStringList( KOPrefs::instance()->mEventSummaryUser, 0 );
60 break; // don't disable 60 break; // don't disable
61 case SUMMARYTODO: 61 case SUMMARYTODO:
62 insertStringList( KOPrefs::instance()->mTodoSummaryUser, 0 ); 62 insertStringList( KOPrefs::instance()->mTodoSummaryUser, 0 );
63 break; // don't disable 63 break; // don't disable
64 } 64 }
65} 65}
66 66
67void KOLocationBox::save(int what) 67void KOLocationBox::save(int what)
68{ 68{
69 strlist.clear(); 69 strlist.clear();
70 for( int l = 0; l < count() ; l++ ) { 70 for( int l = 0; l < count() ; l++ ) {
71 strlist << text( l ); 71 strlist << text( l );
72 } 72 }
73 // strlist.sort(); 73 // strlist.sort();
74 QString currentLine = lineEdit()->text(); 74 QString currentLine = lineEdit()->text();
75 if ( !strlist.contains( currentLine ) ) 75 if ( !strlist.contains( currentLine ) )
76 strlist.prepend( currentLine ); 76 strlist.prepend( currentLine );
77 // qDebug("save %d ", what); 77 // qDebug("save %d ", what);
78 switch(what) { 78 switch(what) {
79 case LOCATION: 79 case LOCATION:
80 KOPrefs::instance()->mLocationDefaults = strlist; 80 KOPrefs::instance()->mLocationDefaults = strlist;
81// KOPrefs::instance()->mLocationUserDefaults = strlist; 81// KOPrefs::instance()->mLocationUserDefaults = strlist;
82 break; // don't disable 82 break; // don't disable
83 case SUMMARYEVENT: 83 case SUMMARYEVENT:
84 KOPrefs::instance()->mEventSummaryUser = strlist; 84 KOPrefs::instance()->mEventSummaryUser = strlist;
85 break; // don't disable 85 break; // don't disable
86 case SUMMARYTODO: 86 case SUMMARYTODO:
87 KOPrefs::instance()->mTodoSummaryUser = strlist; 87 KOPrefs::instance()->mTodoSummaryUser = strlist;
88 break; // don't disable 88 break; // don't disable
89 } 89 }
90} 90}
91 91
92void KOLocationBox::clearItems(int what) 92void KOLocationBox::clearItems(int what)
93{ 93{
94 clear(); 94 clear();
95 save(what); 95 save(what);
96} 96}
diff --git a/korganizer/kolocationbox.h b/korganizer/kolocationbox.h
index be8ea86..b604d33 100644
--- a/korganizer/kolocationbox.h
+++ b/korganizer/kolocationbox.h
@@ -1,55 +1,55 @@
1/* 1/*
2 File Copyright (c) 2004 Dirk Loesche <dirk.loesche@bigfoot.de> 2 File Copyright (c) 2004 Dirk Loesche <dirk.loesche@bigfoot.de>
3 3
4 This file is part of KOrganizer/PI 4 This file is part of KOrganizer/PI
5 KOrganizer Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 5 KOrganizer Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
6 KOrganizer/PI Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net> 6 KOrganizer/PI Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or 10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version. 11 (at your option) any later version.
12 12
13 This program is distributed in the hope that it will be useful, 13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 21
22 As a special exception, permission is given to link this program 22 As a special exception, permission is given to link this program
23 with any edition of Qt, and distribute the resulting executable, 23 with any edition of Qt, and distribute the resulting executable,
24 without including the source code for Qt in the source distribution. 24 without including the source code for Qt in the source distribution.
25*/ 25*/
26 26
27#ifndef KOLOCATIONBOX_H 27#ifndef KOLOCATIONBOX_H
28#define KOLOCATIONBOX_H 28#define KOLOCATIONBOX_H
29 29
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include "koprefs.h" 31#include "koprefs.h"
32 32
33class KOLocationBox : public QComboBox 33class KOLocationBox : public QComboBox
34{ 34{
35 public: 35 public:
36 KOLocationBox( bool rw , QWidget *parent , int _maxItems ); 36 KOLocationBox( bool rw , QWidget *parent , int _maxItems );
37 virtual ~KOLocationBox(); 37 virtual ~KOLocationBox();
38 38
39 enum {LOCATION, SUMMARYEVENT, SUMMARYTODO}; 39 enum {LOCATION, SUMMARYEVENT, SUMMARYTODO};
40 40
41 public slots: 41 public slots:
42 void load(int); 42 void load(int);
43 void save(int); 43 void save(int);
44 void clearItems(int); // clear listbox and config rc items 44 void clearItems(int); // clear listbox and config rc items
45 45
46 protected: 46 protected:
47// void focusOutEvent( QFocusEvent * ); 47// void focusOutEvent( QFocusEvent * );
48// void timerEvent( QTimerEvent * ); 48// void timerEvent( QTimerEvent * );
49 49
50 private: 50 private:
51 int maxItems; // maximal listbox items 51 int maxItems; // maximal listbox items
52 QStringList strlist; // temporary stringlist 52 QStringList strlist; // temporary stringlist
53}; 53};
54 54
55#endif 55#endif
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 4f71788..bd9efc8 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,2113 +1,2113 @@
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 "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "simplealarmclient.h" 62#include "simplealarmclient.h"
63#include "externalapphandler.h" 63#include "externalapphandler.h"
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
70#include "koimportoldialog.h" 70#include "koimportoldialog.h"
71#endif 71#endif
72#endif 72#endif
73#include "mainwindow.h" 73#include "mainwindow.h"
74 74
75 75
76class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
77{ 77{
78 public: 78 public:
79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
80 QDialog( parent, name, true ) 80 QDialog( parent, name, true )
81 { 81 {
82 setCaption( i18n("Export to phone options") ); 82 setCaption( i18n("Export to phone options") );
83 QVBoxLayout* lay = new QVBoxLayout( this ); 83 QVBoxLayout* lay = new QVBoxLayout( this );
84 lay->setSpacing( 3 ); 84 lay->setSpacing( 3 );
85 lay->setMargin( 3 ); 85 lay->setMargin( 3 );
86 QLabel *lab; 86 QLabel *lab;
87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
88 lab->setAlignment (AlignHCenter ); 88 lab->setAlignment (AlignHCenter );
89 QHBox* temphb; 89 QHBox* temphb;
90 temphb = new QHBox( this ); 90 temphb = new QHBox( this );
91 new QLabel( i18n("I/O device: "), temphb ); 91 new QLabel( i18n("I/O device: "), temphb );
92 mPhoneDevice = new QLineEdit( temphb); 92 mPhoneDevice = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 93 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 94 temphb = new QHBox( this );
95 new QLabel( i18n("Connection: "), temphb ); 95 new QLabel( i18n("Connection: "), temphb );
96 mPhoneConnection = new QLineEdit( temphb); 96 mPhoneConnection = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 97 lay->addWidget( temphb );
98 temphb = new QHBox( this ); 98 temphb = new QHBox( this );
99 new QLabel( i18n("Model(opt.): "), temphb ); 99 new QLabel( i18n("Model(opt.): "), temphb );
100 mPhoneModel = new QLineEdit( temphb); 100 mPhoneModel = new QLineEdit( temphb);
101 lay->addWidget( temphb ); 101 lay->addWidget( temphb );
102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
103 mWriteBackFuture->setChecked( true ); 103 mWriteBackFuture->setChecked( true );
104 lay->addWidget( mWriteBackFuture ); 104 lay->addWidget( mWriteBackFuture );
105 temphb = new QHBox( this ); 105 temphb = new QHBox( this );
106 new QLabel( i18n("Max. weeks in future: ") , temphb ); 106 new QLabel( i18n("Max. weeks in future: ") , temphb );
107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
108 mWriteBackFutureWeeks->setValue( 8 ); 108 mWriteBackFutureWeeks->setValue( 8 );
109 lay->addWidget( temphb ); 109 lay->addWidget( temphb );
110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
111 lab->setAlignment (AlignHCenter ); 111 lab->setAlignment (AlignHCenter );
112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
113 lay->addWidget( ok ); 113 lay->addWidget( ok );
114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
115 lay->addWidget( cancel ); 115 lay->addWidget( cancel );
116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
118 resize( 220, 240 ); 118 resize( 220, 240 );
119 qApp->processEvents(); 119 qApp->processEvents();
120 int dw = QApplication::desktop()->width(); 120 int dw = QApplication::desktop()->width();
121 int dh = QApplication::desktop()->height(); 121 int dh = QApplication::desktop()->height();
122 move( (dw-width())/2, (dh - height() )/2 ); 122 move( (dw-width())/2, (dh - height() )/2 );
123 } 123 }
124 124
125public: 125public:
126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
127 QCheckBox* mWriteBackFuture; 127 QCheckBox* mWriteBackFuture;
128 QSpinBox* mWriteBackFutureWeeks; 128 QSpinBox* mWriteBackFutureWeeks;
129}; 129};
130 130
131int globalFlagBlockStartup; 131int globalFlagBlockStartup;
132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
133 QMainWindow( parent, name ) 133 QMainWindow( parent, name )
134{ 134{
135 135
136 mClosed = false; 136 mClosed = false;
137 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 137 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
138 QString confFile = locateLocal("config","korganizerrc"); 138 QString confFile = locateLocal("config","korganizerrc");
139 QFileInfo finf ( confFile ); 139 QFileInfo finf ( confFile );
140 bool showWarning = !finf.exists(); 140 bool showWarning = !finf.exists();
141 setIcon(SmallIcon( "ko24" ) ); 141 setIcon(SmallIcon( "ko24" ) );
142 mBlockAtStartup = true; 142 mBlockAtStartup = true;
143 mFlagKeyPressed = false; 143 mFlagKeyPressed = false;
144 setCaption("KOrganizer/Pi"); 144 setCaption("KOrganizer/Pi");
145 KOPrefs *p = KOPrefs::instance(); 145 KOPrefs *p = KOPrefs::instance();
146 KPimGlobalPrefs::instance()->setGlobalConfig(); 146 KPimGlobalPrefs::instance()->setGlobalConfig();
147 if ( p->mHourSize > 22 ) 147 if ( p->mHourSize > 22 )
148 p->mHourSize = 22; 148 p->mHourSize = 22;
149 QMainWindow::ToolBarDock tbd; 149 QMainWindow::ToolBarDock tbd;
150 if ( p->mToolBarHor ) { 150 if ( p->mToolBarHor ) {
151 if ( p->mToolBarUp ) 151 if ( p->mToolBarUp )
152 tbd = Bottom; 152 tbd = Bottom;
153 else 153 else
154 tbd = Top; 154 tbd = Top;
155 } 155 }
156 else { 156 else {
157 if ( p->mToolBarUp ) 157 if ( p->mToolBarUp )
158 tbd = Right; 158 tbd = Right;
159 else 159 else
160 tbd = Left; 160 tbd = Left;
161 } 161 }
162 if ( KOPrefs::instance()->mUseAppColors ) 162 if ( KOPrefs::instance()->mUseAppColors )
163 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 163 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
164 globalFlagBlockStartup = 1; 164 globalFlagBlockStartup = 1;
165 iconToolBar = new QPEToolBar( this ); 165 iconToolBar = new QPEToolBar( this );
166 addToolBar (iconToolBar , tbd ); 166 addToolBar (iconToolBar , tbd );
167 mCalendarModifiedFlag = false; 167 mCalendarModifiedFlag = false;
168 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 168 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
169 splash->setAlignment ( AlignCenter ); 169 splash->setAlignment ( AlignCenter );
170 setCentralWidget( splash ); 170 setCentralWidget( splash );
171#ifndef DESKTOP_VERSION 171#ifndef DESKTOP_VERSION
172 showMaximized(); 172 showMaximized();
173#endif 173#endif
174 174
175 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 175 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
176 setDefaultPreferences(); 176 setDefaultPreferences();
177 mCalendar = new CalendarLocal(); 177 mCalendar = new CalendarLocal();
178 mView = new CalendarView( mCalendar, this,"mCalendar " ); 178 mView = new CalendarView( mCalendar, this,"mCalendar " );
179 mView->hide(); 179 mView->hide();
180 //mView->resize(splash->size() ); 180 //mView->resize(splash->size() );
181 initActions(); 181 initActions();
182 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 182 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
183 mSyncManager->setBlockSave(false); 183 mSyncManager->setBlockSave(false);
184 mView->setSyncManager(mSyncManager); 184 mView->setSyncManager(mSyncManager);
185#ifndef DESKTOP_VERSION 185#ifndef DESKTOP_VERSION
186 iconToolBar->show(); 186 iconToolBar->show();
187 qApp->processEvents(); 187 qApp->processEvents();
188#endif 188#endif
189 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 189 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
190 int vh = height() ; 190 int vh = height() ;
191 int vw = width(); 191 int vw = width();
192 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 192 //qDebug("Toolbar hei %d ",iconToolBar->height() );
193 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 193 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
194 vh -= iconToolBar->height(); 194 vh -= iconToolBar->height();
195 } else { 195 } else {
196 vw -= iconToolBar->height(); 196 vw -= iconToolBar->height();
197 } 197 }
198 //mView->setMaximumSize( splash->size() ); 198 //mView->setMaximumSize( splash->size() );
199 //mView->resize( splash->size() ); 199 //mView->resize( splash->size() );
200 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 200 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
201 mView->readSettings(); 201 mView->readSettings();
202 bool newFile = false; 202 bool newFile = false;
203 if( !QFile::exists( defaultFileName() ) ) { 203 if( !QFile::exists( defaultFileName() ) ) {
204 QFileInfo finfo ( defaultFileName() ); 204 QFileInfo finfo ( defaultFileName() );
205 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 205 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
206 qDebug("oldfile %s ", oldFile.latin1()); 206 qDebug("oldfile %s ", oldFile.latin1());
207 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"; 207 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";
208 finfo.setFile( oldFile ); 208 finfo.setFile( oldFile );
209 if (finfo.exists() ) { 209 if (finfo.exists() ) {
210 KMessageBox::information( this, message); 210 KMessageBox::information( this, message);
211 mView->openCalendar( oldFile ); 211 mView->openCalendar( oldFile );
212 qApp->processEvents(); 212 qApp->processEvents();
213 } else { 213 } else {
214 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 214 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
215 finfo.setFile( oldFile ); 215 finfo.setFile( oldFile );
216 if (finfo.exists() ) { 216 if (finfo.exists() ) {
217 KMessageBox::information( this, message); 217 KMessageBox::information( this, message);
218 mView->openCalendar( oldFile ); 218 mView->openCalendar( oldFile );
219 qApp->processEvents(); 219 qApp->processEvents();
220 } 220 }
221 } 221 }
222 mView->saveCalendar( defaultFileName() ); 222 mView->saveCalendar( defaultFileName() );
223 newFile = true; 223 newFile = true;
224 } 224 }
225 225
226 QTime neededSaveTime = QDateTime::currentDateTime().time(); 226 QTime neededSaveTime = QDateTime::currentDateTime().time();
227 mView->openCalendar( defaultFileName() ); 227 mView->openCalendar( defaultFileName() );
228 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 228 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
229 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 229 qDebug("KO: Calendar loading time: %d ms",msNeeded );
230 230
231 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 231 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
232 KOPrefs::instance()->setAllDefaults(); 232 KOPrefs::instance()->setAllDefaults();
233 int count = mView->addCategories(); 233 int count = mView->addCategories();
234 } 234 }
235 processIncidenceSelection( 0 ); 235 processIncidenceSelection( 0 );
236 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 236 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
237 SLOT( processIncidenceSelection( Incidence * ) ) ); 237 SLOT( processIncidenceSelection( Incidence * ) ) );
238 connect( mView, SIGNAL( modifiedChanged( bool ) ), 238 connect( mView, SIGNAL( modifiedChanged( bool ) ),
239 SLOT( slotModifiedChanged( bool ) ) ); 239 SLOT( slotModifiedChanged( bool ) ) );
240 240
241 241
242 connect( mView, SIGNAL( tempDisableBR(bool) ), 242 connect( mView, SIGNAL( tempDisableBR(bool) ),
243 SLOT( disableBR(bool) ) ); 243 SLOT( disableBR(bool) ) );
244 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 244 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
245 mView->setModified( false ); 245 mView->setModified( false );
246 mBlockAtStartup = false; 246 mBlockAtStartup = false;
247 mView->setModified( false ); 247 mView->setModified( false );
248 setCentralWidget( mView ); 248 setCentralWidget( mView );
249 globalFlagBlockStartup = 0; 249 globalFlagBlockStartup = 0;
250 mView->show(); 250 mView->show();
251 delete splash; 251 delete splash;
252 if ( newFile ) 252 if ( newFile )
253 mView->updateConfig(); 253 mView->updateConfig();
254 // qApp->processEvents(); 254 // qApp->processEvents();
255 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 255 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
256 //fillSyncMenu(); 256 //fillSyncMenu();
257 257
258 258
259 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 259 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
260 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 260 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
261 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 261 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
262 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 262 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
263 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 263 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
264 mSyncManager->setDefaultFileName( sentSyncFile()); 264 mSyncManager->setDefaultFileName( sentSyncFile());
265 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 265 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
266 mSyncManager->fillSyncMenu(); 266 mSyncManager->fillSyncMenu();
267 267
268 268
269 269
270 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 270 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
271 if ( showWarning ) { 271 if ( showWarning ) {
272 KMessageBox::information( this, 272 KMessageBox::information( this,
273 "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"); 273 "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");
274 qApp->processEvents(); 274 qApp->processEvents();
275 mView->dialogManager()->showSyncOptions(); 275 mView->dialogManager()->showSyncOptions();
276 } 276 }
277 277
278 //US listen for result adressed from Ka/Pi 278 //US listen for result adressed from Ka/Pi
279#ifndef DESKTOP_VERSION 279#ifndef DESKTOP_VERSION
280 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 280 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
281#endif 281#endif
282#ifndef DESKTOP_VERSION 282#ifndef DESKTOP_VERSION
283 infrared = 0; 283 infrared = 0;
284#endif 284#endif
285 updateWeek( mView->startDate() ); 285 updateWeek( mView->startDate() );
286 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 286 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
287 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 287 SLOT( updateWeekNum( const KCal::DateList & ) ) );
288 mBRdisabled = false; 288 mBRdisabled = false;
289 //toggleBeamReceive(); 289 //toggleBeamReceive();
290} 290}
291MainWindow::~MainWindow() 291MainWindow::~MainWindow()
292{ 292{
293 //qDebug("MainWindow::~MainWindow() "); 293 //qDebug("MainWindow::~MainWindow() ");
294 //save toolbar location 294 //save toolbar location
295 delete mCalendar; 295 delete mCalendar;
296 delete mSyncManager; 296 delete mSyncManager;
297#ifndef DESKTOP_VERSION 297#ifndef DESKTOP_VERSION
298 if ( infrared ) 298 if ( infrared )
299 delete infrared; 299 delete infrared;
300#endif 300#endif
301 301
302 302
303} 303}
304 304
305void MainWindow::disableBR(bool b) 305void MainWindow::disableBR(bool b)
306{ 306{
307#ifndef DESKTOP_VERSION 307#ifndef DESKTOP_VERSION
308 if ( b ) { 308 if ( b ) {
309 if ( infrared ) { 309 if ( infrared ) {
310 toggleBeamReceive(); 310 toggleBeamReceive();
311 mBRdisabled = true; 311 mBRdisabled = true;
312 } 312 }
313 mBRdisabled = true; 313 mBRdisabled = true;
314 } else { 314 } else {
315 if ( mBRdisabled ) { 315 if ( mBRdisabled ) {
316 mBRdisabled = false; 316 mBRdisabled = false;
317 //makes no sense,because other cal ap is probably running 317 //makes no sense,because other cal ap is probably running
318 // toggleBeamReceive(); 318 // toggleBeamReceive();
319 } 319 }
320 } 320 }
321#endif 321#endif
322 322
323} 323}
324bool MainWindow::beamReceiveEnabled() 324bool MainWindow::beamReceiveEnabled()
325{ 325{
326#ifndef DESKTOP_VERSION 326#ifndef DESKTOP_VERSION
327 return ( infrared != 0 ); 327 return ( infrared != 0 );
328#endif 328#endif
329 return false; 329 return false;
330} 330}
331 331
332void MainWindow::toggleBeamReceive() 332void MainWindow::toggleBeamReceive()
333{ 333{
334 if ( mBRdisabled ) 334 if ( mBRdisabled )
335 return; 335 return;
336#ifndef DESKTOP_VERSION 336#ifndef DESKTOP_VERSION
337 if ( infrared ) { 337 if ( infrared ) {
338 qDebug("disable BeamReceive "); 338 qDebug("disable BeamReceive ");
339 delete infrared; 339 delete infrared;
340 infrared = 0; 340 infrared = 0;
341 brAction->setOn(false); 341 brAction->setOn(false);
342 return; 342 return;
343 } 343 }
344 qDebug("enable BeamReceive "); 344 qDebug("enable BeamReceive ");
345 brAction->setOn(true); 345 brAction->setOn(true);
346 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 346 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
347 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 347 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
348#endif 348#endif
349} 349}
350void MainWindow::showMaximized () 350void MainWindow::showMaximized ()
351{ 351{
352#ifndef DESKTOP_VERSION 352#ifndef DESKTOP_VERSION
353 if ( ! globalFlagBlockStartup ) 353 if ( ! globalFlagBlockStartup )
354 if ( mClosed ) 354 if ( mClosed )
355 mView->goToday(); 355 mView->goToday();
356#endif 356#endif
357 QWidget::showMaximized () ; 357 QWidget::showMaximized () ;
358 mClosed = false; 358 mClosed = false;
359} 359}
360void MainWindow::closeEvent( QCloseEvent* ce ) 360void MainWindow::closeEvent( QCloseEvent* ce )
361{ 361{
362 362
363 363
364 364
365 if ( ! KOPrefs::instance()->mAskForQuit ) { 365 if ( ! KOPrefs::instance()->mAskForQuit ) {
366 saveOnClose(); 366 saveOnClose();
367 mClosed = true; 367 mClosed = true;
368 ce->accept(); 368 ce->accept();
369 return; 369 return;
370 370
371 } 371 }
372 372
373 switch( QMessageBox::information( this, "KO/Pi", 373 switch( QMessageBox::information( this, "KO/Pi",
374 i18n("Do you really want\nto close KO/Pi?"), 374 i18n("Do you really want\nto close KO/Pi?"),
375 i18n("Close"), i18n("No"), 375 i18n("Close"), i18n("No"),
376 0, 0 ) ) { 376 0, 0 ) ) {
377 case 0: 377 case 0:
378 saveOnClose(); 378 saveOnClose();
379 mClosed = true; 379 mClosed = true;
380 ce->accept(); 380 ce->accept();
381 break; 381 break;
382 case 1: 382 case 1:
383 ce->ignore(); 383 ce->ignore();
384 break; 384 break;
385 case 2: 385 case 2:
386 386
387 default: 387 default:
388 break; 388 break;
389 } 389 }
390 390
391 391
392} 392}
393 393
394void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 394void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
395{ 395{
396 QDataStream stream( data, IO_ReadOnly ); 396 QDataStream stream( data, IO_ReadOnly );
397 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 397 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
398 //QString datamess; 398 //QString datamess;
399 //qDebug("message "); 399 //qDebug("message ");
400 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 400 qDebug("KO: QCOP message received: %s ", cmsg.data() );
401 401
402 if ( cmsg == "setDocument(QString)" ) { 402 if ( cmsg == "setDocument(QString)" ) {
403 QDataStream stream( data, IO_ReadOnly ); 403 QDataStream stream( data, IO_ReadOnly );
404 QString fileName; 404 QString fileName;
405 stream >> fileName; 405 stream >> fileName;
406 //qDebug("filename %s ", fileName.latin1()); 406 //qDebug("filename %s ", fileName.latin1());
407 showMaximized(); 407 showMaximized();
408 raise(); 408 raise();
409 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 409 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
410 mSyncManager->slotSyncMenu( 1002 ); 410 mSyncManager->slotSyncMenu( 1002 );
411 return; 411 return;
412 } 412 }
413 413
414 if ( cmsg == "-writeFile" ) { 414 if ( cmsg == "-writeFile" ) {
415 // I made from the "-writeFile" an "-writeAlarm" 415 // I made from the "-writeFile" an "-writeAlarm"
416 mView->viewManager()->showWhatsNextView(); 416 mView->viewManager()->showWhatsNextView();
417 mCalendar->checkAlarmForIncidence( 0, true); 417 mCalendar->checkAlarmForIncidence( 0, true);
418 showMaximized(); 418 showMaximized();
419 raise(); 419 raise();
420 return; 420 return;
421 421
422 } 422 }
423 if ( cmsg == "-writeFileSilent" ) { 423 if ( cmsg == "-writeFileSilent" ) {
424 // I made from the "-writeFile" an "-writeAlarm" 424 // I made from the "-writeFile" an "-writeAlarm"
425 // mView->viewManager()->showWhatsNextView(); 425 // mView->viewManager()->showWhatsNextView();
426 mCalendar->checkAlarmForIncidence( 0, true); 426 mCalendar->checkAlarmForIncidence( 0, true);
427 //showMaximized(); 427 //showMaximized();
428 //raise(); 428 //raise();
429 hide(); 429 hide();
430 return; 430 return;
431 } 431 }
432 if ( cmsg == "-newCountdown" ) { 432 if ( cmsg == "-newCountdown" ) {
433 qDebug("newCountdown "); 433 qDebug("newCountdown ");
434 434
435 } 435 }
436 QString msg ; 436 QString msg ;
437 QString allmsg = cmsg; 437 QString allmsg = cmsg;
438 while ( allmsg.length() > 0 ) { 438 while ( allmsg.length() > 0 ) {
439 int nextC = allmsg.find( "-", 1 ); 439 int nextC = allmsg.find( "-", 1 );
440 if ( nextC == -1 ) { 440 if ( nextC == -1 ) {
441 msg = allmsg; 441 msg = allmsg;
442 allmsg = ""; 442 allmsg = "";
443 } else{ 443 } else{
444 msg = allmsg.left( nextC ); 444 msg = allmsg.left( nextC );
445 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 445 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
446 } 446 }
447 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 447 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
448 if ( msg == "-newEvent" ) { 448 if ( msg == "-newEvent" ) {
449 mView->newEvent(); 449 mView->newEvent();
450 } 450 }
451 if ( msg == "-newTodo" ) { 451 if ( msg == "-newTodo" ) {
452 mView->newTodo(); 452 mView->newTodo();
453 453
454 } 454 }
455 if ( msg == "-showWN" ) { 455 if ( msg == "-showWN" ) {
456 mView->viewManager()->showWhatsNextView(); 456 mView->viewManager()->showWhatsNextView();
457 } 457 }
458 if ( msg == "-showTodo" ) { 458 if ( msg == "-showTodo" ) {
459 mView->viewManager()->showTodoView(); 459 mView->viewManager()->showTodoView();
460 } 460 }
461 if ( msg == "-showList" ) { 461 if ( msg == "-showList" ) {
462 mView->viewManager()->showListView(); 462 mView->viewManager()->showListView();
463 } 463 }
464 else if ( msg == "-showDay" ) { 464 else if ( msg == "-showDay" ) {
465 mView->viewManager()->showDayView(); 465 mView->viewManager()->showDayView();
466 } 466 }
467 else if ( msg == "-showWWeek" ) { 467 else if ( msg == "-showWWeek" ) {
468 mView->viewManager()->showWorkWeekView(); 468 mView->viewManager()->showWorkWeekView();
469 } 469 }
470 else if ( msg == "-ringSync" ) { 470 else if ( msg == "-ringSync" ) {
471 mSyncManager->multiSync( false ); 471 mSyncManager->multiSync( false );
472 } 472 }
473 else if ( msg == "-showWeek" ) { 473 else if ( msg == "-showWeek" ) {
474 mView->viewManager()->showWeekView(); 474 mView->viewManager()->showWeekView();
475 } 475 }
476 else if ( msg == "-showTodo" ) { 476 else if ( msg == "-showTodo" ) {
477 mView->viewManager()->showTodoView(); 477 mView->viewManager()->showTodoView();
478 } 478 }
479 else if ( msg == "-showJournal" ) { 479 else if ( msg == "-showJournal" ) {
480 mView->dateNavigator()->selectDates( 1 ); 480 mView->dateNavigator()->selectDates( 1 );
481 mView->dateNavigator()->selectToday(); 481 mView->dateNavigator()->selectToday();
482 mView->viewManager()->showJournalView(); 482 mView->viewManager()->showJournalView();
483 } 483 }
484 else if ( msg == "-showKO" ) { 484 else if ( msg == "-showKO" ) {
485 mView->viewManager()->showNextXView(); 485 mView->viewManager()->showNextXView();
486 } 486 }
487 else if ( msg == "-showWNext" || msg == "nextView()" ) { 487 else if ( msg == "-showWNext" || msg == "nextView()" ) {
488 mView->viewManager()->showWhatsNextView(); 488 mView->viewManager()->showWhatsNextView();
489 } 489 }
490 else if ( msg == "-showNextXView" ) { 490 else if ( msg == "-showNextXView" ) {
491 mView->viewManager()->showNextXView(); 491 mView->viewManager()->showNextXView();
492 } 492 }
493 493
494 494
495 } 495 }
496 496
497 showMaximized(); 497 showMaximized();
498 raise(); 498 raise();
499} 499}
500 500
501QPixmap MainWindow::loadPixmap( QString name ) 501QPixmap MainWindow::loadPixmap( QString name )
502{ 502{
503 return SmallIcon( name ); 503 return SmallIcon( name );
504 504
505} 505}
506void MainWindow::initActions() 506void MainWindow::initActions()
507{ 507{
508 //KOPrefs::instance()->mShowFullMenu 508 //KOPrefs::instance()->mShowFullMenu
509 iconToolBar->clear(); 509 iconToolBar->clear();
510 KOPrefs *p = KOPrefs::instance(); 510 KOPrefs *p = KOPrefs::instance();
511 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 511 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
512 512
513 QPopupMenu *viewMenu = new QPopupMenu( this ); 513 QPopupMenu *viewMenu = new QPopupMenu( this );
514 QPopupMenu *actionMenu = new QPopupMenu( this ); 514 QPopupMenu *actionMenu = new QPopupMenu( this );
515 QPopupMenu *importMenu = new QPopupMenu( this ); 515 QPopupMenu *importMenu = new QPopupMenu( this );
516 QPopupMenu *importMenu_X = new QPopupMenu( this ); 516 QPopupMenu *importMenu_X = new QPopupMenu( this );
517 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 517 QPopupMenu *exportMenu_X = new QPopupMenu( this );
518 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 518 QPopupMenu *beamMenu_X = new QPopupMenu( this );
519 selectFilterMenu = new QPopupMenu( this ); 519 selectFilterMenu = new QPopupMenu( this );
520 selectFilterMenu->setCheckable( true ); 520 selectFilterMenu->setCheckable( true );
521 syncMenu = new QPopupMenu( this ); 521 syncMenu = new QPopupMenu( this );
522 configureAgendaMenu = new QPopupMenu( this ); 522 configureAgendaMenu = new QPopupMenu( this );
523 configureToolBarMenu = new QPopupMenu( this ); 523 configureToolBarMenu = new QPopupMenu( this );
524 QPopupMenu *helpMenu = new QPopupMenu( this ); 524 QPopupMenu *helpMenu = new QPopupMenu( this );
525 QIconSet icon; 525 QIconSet icon;
526 int pixWid = 22, pixHei = 22; 526 int pixWid = 22, pixHei = 22;
527 QString pathString = ""; 527 QString pathString = "";
528 if ( !p->mToolBarMiniIcons ) { 528 if ( !p->mToolBarMiniIcons ) {
529 if ( QApplication::desktop()->width() < 480 ) { 529 if ( QApplication::desktop()->width() < 480 ) {
530 pathString += "icons16/"; 530 pathString += "icons16/";
531 pixWid = 18; pixHei = 16; 531 pixWid = 18; pixHei = 16;
532 } 532 }
533 } else { 533 } else {
534 pathString += "iconsmini/"; 534 pathString += "iconsmini/";
535 pixWid = 18; pixHei = 16; 535 pixWid = 18; pixHei = 16;
536 } 536 }
537 if ( KOPrefs::instance()->mShowFullMenu ) { 537 if ( KOPrefs::instance()->mShowFullMenu ) {
538 QMenuBar *menuBar1; 538 QMenuBar *menuBar1;
539 menuBar1 = menuBar(); 539 menuBar1 = menuBar();
540 menuBar1->insertItem( i18n("File"), importMenu ); 540 menuBar1->insertItem( i18n("File"), importMenu );
541 menuBar1->insertItem( i18n("View"), viewMenu ); 541 menuBar1->insertItem( i18n("View"), viewMenu );
542 menuBar1->insertItem( i18n("Actions"), actionMenu ); 542 menuBar1->insertItem( i18n("Actions"), actionMenu );
543#ifdef DESKTOP_VERSION 543#ifdef DESKTOP_VERSION
544 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 544 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
545 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 545 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
546#else 546#else
547 menuBar1->insertItem( i18n("Sync"), syncMenu ); 547 menuBar1->insertItem( i18n("Sync"), syncMenu );
548 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 548 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
549#endif 549#endif
550 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 550 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
551 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 551 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
552 menuBar1->insertItem( i18n("Help"), helpMenu ); 552 menuBar1->insertItem( i18n("Help"), helpMenu );
553 } else { 553 } else {
554 QPEMenuBar *menuBar1; 554 QPEMenuBar *menuBar1;
555 menuBar1 = new QPEMenuBar( iconToolBar ); 555 menuBar1 = new QPEMenuBar( iconToolBar );
556 QPopupMenu *menuBar = new QPopupMenu( this ); 556 QPopupMenu *menuBar = new QPopupMenu( this );
557 icon = loadPixmap( pathString + "z_menu" ); 557 icon = loadPixmap( pathString + "z_menu" );
558 menuBar1->insertItem( icon.pixmap(), menuBar); 558 menuBar1->insertItem( icon.pixmap(), menuBar);
559 //menuBar1->insertItem( i18n("ME"), menuBar); 559 //menuBar1->insertItem( i18n("ME"), menuBar);
560 menuBar->insertItem( i18n("File"), importMenu ); 560 menuBar->insertItem( i18n("File"), importMenu );
561 menuBar->insertItem( i18n("View"), viewMenu ); 561 menuBar->insertItem( i18n("View"), viewMenu );
562 menuBar->insertItem( i18n("Actions"), actionMenu ); 562 menuBar->insertItem( i18n("Actions"), actionMenu );
563 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 563 menuBar->insertItem( i18n("Synchronize"), syncMenu );
564 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 564 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
565 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 565 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
566 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 566 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
567 menuBar->insertItem( i18n("Help"), helpMenu ); 567 menuBar->insertItem( i18n("Help"), helpMenu );
568 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 568 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
569 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 569 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
570 } 570 }
571 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 571 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
572 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 572 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
573 mWeekBgColor = iconToolBar->backgroundColor(); 573 mWeekBgColor = iconToolBar->backgroundColor();
574 mWeekPixmap.resize( pixWid , pixHei ); 574 mWeekPixmap.resize( pixWid , pixHei );
575 mWeekPixmap.fill( mWeekBgColor ); 575 mWeekPixmap.fill( mWeekBgColor );
576 icon = mWeekPixmap; 576 icon = mWeekPixmap;
577 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 577 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
578 if ( p-> mShowIconWeekNum ) 578 if ( p-> mShowIconWeekNum )
579 mWeekAction->addTo( iconToolBar ); 579 mWeekAction->addTo( iconToolBar );
580 mWeekFont = font(); 580 mWeekFont = font();
581 581
582 int fontPoint = mWeekFont.pointSize(); 582 int fontPoint = mWeekFont.pointSize();
583 QFontMetrics f( mWeekFont ); 583 QFontMetrics f( mWeekFont );
584 int fontWid = f.width( "30" ); 584 int fontWid = f.width( "30" );
585 while ( fontWid > pixWid ) { 585 while ( fontWid > pixWid ) {
586 --fontPoint; 586 --fontPoint;
587 mWeekFont.setPointSize( fontPoint ); 587 mWeekFont.setPointSize( fontPoint );
588 QFontMetrics f( mWeekFont ); 588 QFontMetrics f( mWeekFont );
589 fontWid = f.width( "30" ); 589 fontWid = f.width( "30" );
590 qDebug("dec-- "); 590 qDebug("dec-- ");
591 } 591 }
592 592
593 connect( mWeekAction, SIGNAL( activated() ), 593 connect( mWeekAction, SIGNAL( activated() ),
594 this, SLOT( weekAction() ) ); 594 this, SLOT( weekAction() ) );
595 595
596 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 596 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
597 597
598 //#endif 598 //#endif
599 // ****************** 599 // ******************
600 QAction *action; 600 QAction *action;
601 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 601 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
602 configureToolBarMenu->setCheckable( true ); 602 configureToolBarMenu->setCheckable( true );
603 603
604 604
605 configureAgendaMenu->setCheckable( true ); 605 configureAgendaMenu->setCheckable( true );
606 int iii ; 606 int iii ;
607 for ( iii = 1;iii<= 10 ;++iii ){ 607 for ( iii = 1;iii<= 10 ;++iii ){
608 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 608 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
609 } 609 }
610 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 610 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
611 611
612 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 612 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
613 this, SLOT( showConfigureAgenda( ) ) ); 613 this, SLOT( showConfigureAgenda( ) ) );
614 614
615 icon = loadPixmap( pathString + "configure" ); 615 icon = loadPixmap( pathString + "configure" );
616 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 616 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
617 action->addTo( actionMenu ); 617 action->addTo( actionMenu );
618 connect( action, SIGNAL( activated() ), 618 connect( action, SIGNAL( activated() ),
619 mView, SLOT( edit_options() ) ); 619 mView, SLOT( edit_options() ) );
620 actionMenu->insertSeparator(); 620 actionMenu->insertSeparator();
621 621
622 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 622 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
623 action->addTo( actionMenu ); 623 action->addTo( actionMenu );
624 connect( action, SIGNAL( activated() ), 624 connect( action, SIGNAL( activated() ),
625 mView, SLOT( undo_delete() ) ); 625 mView, SLOT( undo_delete() ) );
626 actionMenu->insertSeparator(); 626 actionMenu->insertSeparator();
627 627
628 icon = loadPixmap( pathString + "newevent" ); 628 icon = loadPixmap( pathString + "newevent" );
629 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 629 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
630 configureToolBarMenu->insertSeparator(); 630 configureToolBarMenu->insertSeparator();
631 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 631 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
632 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 632 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
633 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 633 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
634 ne_action->addTo( actionMenu ); 634 ne_action->addTo( actionMenu );
635 connect( ne_action, SIGNAL( activated() ), 635 connect( ne_action, SIGNAL( activated() ),
636 mView, SLOT( newEvent() ) ); 636 mView, SLOT( newEvent() ) );
637 icon = loadPixmap( pathString + "newtodo" ); 637 icon = loadPixmap( pathString + "newtodo" );
638 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 638 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
639 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 639 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
640 nt_action->addTo( actionMenu ); 640 nt_action->addTo( actionMenu );
641 connect( nt_action, SIGNAL( activated() ), 641 connect( nt_action, SIGNAL( activated() ),
642 mView, SLOT( newTodo() ) ); 642 mView, SLOT( newTodo() ) );
643 643
644 icon = loadPixmap( pathString + "today" ); 644 icon = loadPixmap( pathString + "today" );
645 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 645 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
646 today_action->addTo( viewMenu ); 646 today_action->addTo( viewMenu );
647 connect( today_action, SIGNAL( activated() ), 647 connect( today_action, SIGNAL( activated() ),
648 mView, SLOT( goToday() ) ); 648 mView, SLOT( goToday() ) );
649 viewMenu->insertSeparator(); 649 viewMenu->insertSeparator();
650 650
651 icon = loadPixmap( pathString + "navi" ); 651 icon = loadPixmap( pathString + "navi" );
652 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 652 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
653 action->addTo( viewMenu ); 653 action->addTo( viewMenu );
654 connect( action, SIGNAL( activated() ), 654 connect( action, SIGNAL( activated() ),
655 mView, SLOT( toggleDateNavigatorWidget() ) ); 655 mView, SLOT( toggleDateNavigatorWidget() ) );
656 mToggleNav = action ; 656 mToggleNav = action ;
657 icon = loadPixmap( pathString + "filter" ); 657 icon = loadPixmap( pathString + "filter" );
658 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 658 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
659 action->addTo( viewMenu ); 659 action->addTo( viewMenu );
660 connect( action, SIGNAL( activated() ), 660 connect( action, SIGNAL( activated() ),
661 mView, SLOT( toggleFilter() ) ); 661 mView, SLOT( toggleFilter() ) );
662 mToggleFilter = action; 662 mToggleFilter = action;
663 icon = loadPixmap( pathString + "allday" ); 663 icon = loadPixmap( pathString + "allday" );
664 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 664 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
665 action->addTo( viewMenu ); 665 action->addTo( viewMenu );
666 connect( action, SIGNAL( activated() ), 666 connect( action, SIGNAL( activated() ),
667 mView, SLOT( toggleAllDaySize() ) ); 667 mView, SLOT( toggleAllDaySize() ) );
668 mToggleAllday = action; 668 mToggleAllday = action;
669 669
670 670
671 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 671 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
672 mToggleNav, SLOT( setEnabled ( bool ) ) ); 672 mToggleNav, SLOT( setEnabled ( bool ) ) );
673 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 673 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
674 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 674 mToggleFilter, SLOT( setEnabled ( bool ) ) );
675 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 675 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
676 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 676 mToggleAllday, SLOT( setEnabled ( bool ) ) );
677 677
678 viewMenu->insertSeparator(); 678 viewMenu->insertSeparator();
679 icon = loadPixmap( pathString + "picker" ); 679 icon = loadPixmap( pathString + "picker" );
680 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 680 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
681 action->addTo( viewMenu ); 681 action->addTo( viewMenu );
682 connect( action, SIGNAL( activated() ), 682 connect( action, SIGNAL( activated() ),
683 mView, SLOT( showDatePicker() ) ); 683 mView, SLOT( showDatePicker() ) );
684 action->addTo( iconToolBar ); 684 action->addTo( iconToolBar );
685 viewMenu->insertSeparator(); 685 viewMenu->insertSeparator();
686 icon = loadPixmap( pathString + "list" ); 686 icon = loadPixmap( pathString + "list" );
687 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 687 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
688 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 688 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
689 showlist_action->addTo( viewMenu ); 689 showlist_action->addTo( viewMenu );
690 connect( showlist_action, SIGNAL( activated() ), 690 connect( showlist_action, SIGNAL( activated() ),
691 mView->viewManager(), SLOT( showListView() ) ); 691 mView->viewManager(), SLOT( showListView() ) );
692 692
693 693
694 icon = loadPixmap( pathString + "day" ); 694 icon = loadPixmap( pathString + "day" );
695 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 695 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
696 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 696 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
697 day1_action->addTo( viewMenu ); 697 day1_action->addTo( viewMenu );
698 // action->addTo( toolBar ); 698 // action->addTo( toolBar );
699 connect( day1_action, SIGNAL( activated() ), 699 connect( day1_action, SIGNAL( activated() ),
700 mView->viewManager(), SLOT( showDayView() ) ); 700 mView->viewManager(), SLOT( showDayView() ) );
701 701
702 icon = loadPixmap( pathString + "workweek" ); 702 icon = loadPixmap( pathString + "workweek" );
703 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 703 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
704 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 704 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
705 day5_action->addTo( viewMenu ); 705 day5_action->addTo( viewMenu );
706 connect( day5_action, SIGNAL( activated() ), 706 connect( day5_action, SIGNAL( activated() ),
707 mView->viewManager(), SLOT( showWorkWeekView() ) ); 707 mView->viewManager(), SLOT( showWorkWeekView() ) );
708 708
709 icon = loadPixmap( pathString + "week" ); 709 icon = loadPixmap( pathString + "week" );
710 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 710 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
711 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 711 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
712 day7_action->addTo( viewMenu ); 712 day7_action->addTo( viewMenu );
713 connect( day7_action, SIGNAL( activated() ), 713 connect( day7_action, SIGNAL( activated() ),
714 mView->viewManager(), SLOT( showWeekView() ) ); 714 mView->viewManager(), SLOT( showWeekView() ) );
715 715
716 icon = loadPixmap( pathString + "workweek2" ); 716 icon = loadPixmap( pathString + "workweek2" );
717 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 717 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
718 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 718 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
719 day6_action->addTo( viewMenu ); 719 day6_action->addTo( viewMenu );
720 connect( day6_action, SIGNAL( activated() ), 720 connect( day6_action, SIGNAL( activated() ),
721 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 721 mView->viewManager(), SLOT( showMonthViewWeek() ) );
722 722
723 icon = loadPixmap( pathString + "month" ); 723 icon = loadPixmap( pathString + "month" );
724 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 724 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
725 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 725 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
726 month_action->addTo( viewMenu ); 726 month_action->addTo( viewMenu );
727 connect( month_action, SIGNAL( activated() ), 727 connect( month_action, SIGNAL( activated() ),
728 mView->viewManager(), SLOT( showMonthView() ) ); 728 mView->viewManager(), SLOT( showMonthView() ) );
729 729
730 icon = loadPixmap( pathString + "todo" ); 730 icon = loadPixmap( pathString + "todo" );
731 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 731 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
732 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 732 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
733 todoview_action->addTo( viewMenu ); 733 todoview_action->addTo( viewMenu );
734 connect( todoview_action, SIGNAL( activated() ), 734 connect( todoview_action, SIGNAL( activated() ),
735 mView->viewManager(), SLOT( showTodoView() ) ); 735 mView->viewManager(), SLOT( showTodoView() ) );
736 736
737 icon = loadPixmap( pathString + "journal" ); 737 icon = loadPixmap( pathString + "journal" );
738 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 738 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
739 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 739 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
740 viewjournal_action->addTo( viewMenu ); 740 viewjournal_action->addTo( viewMenu );
741 connect( viewjournal_action, SIGNAL( activated() ), 741 connect( viewjournal_action, SIGNAL( activated() ),
742 mView->viewManager(), SLOT( showJournalView() ) ); 742 mView->viewManager(), SLOT( showJournalView() ) );
743 743
744 icon = loadPixmap( pathString + "xdays" ); 744 icon = loadPixmap( pathString + "xdays" );
745 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 745 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
746 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 746 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
747 xdays_action->addTo( viewMenu ); 747 xdays_action->addTo( viewMenu );
748 connect( xdays_action, SIGNAL( activated() ), 748 connect( xdays_action, SIGNAL( activated() ),
749 mView->viewManager(), SLOT( showNextXView() ) ); 749 mView->viewManager(), SLOT( showNextXView() ) );
750 750
751 icon = loadPixmap( pathString + "whatsnext" ); 751 icon = loadPixmap( pathString + "whatsnext" );
752 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 752 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
753 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 753 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
754 whatsnext_action->addTo( viewMenu ); 754 whatsnext_action->addTo( viewMenu );
755 connect( whatsnext_action, SIGNAL( activated() ), 755 connect( whatsnext_action, SIGNAL( activated() ),
756 mView->viewManager(), SLOT( showWhatsNextView() ) ); 756 mView->viewManager(), SLOT( showWhatsNextView() ) );
757 757
758#if 0 758#if 0
759 action = new QAction( "view_timespan", "Time Span", 0, this ); 759 action = new QAction( "view_timespan", "Time Span", 0, this );
760 action->addTo( viewMenu ); 760 action->addTo( viewMenu );
761 connect( action, SIGNAL( activated() ), 761 connect( action, SIGNAL( activated() ),
762 mView->viewManager(), SLOT( showTimeSpanView() ) ); 762 mView->viewManager(), SLOT( showTimeSpanView() ) );
763#endif 763#endif
764 764
765 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 765 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
766 this ); 766 this );
767 mNewSubTodoAction->addTo( actionMenu ); 767 mNewSubTodoAction->addTo( actionMenu );
768 connect( mNewSubTodoAction, SIGNAL( activated() ), 768 connect( mNewSubTodoAction, SIGNAL( activated() ),
769 mView, SLOT( newSubTodo() ) ); 769 mView, SLOT( newSubTodo() ) );
770 770
771 actionMenu->insertSeparator(); 771 actionMenu->insertSeparator();
772 772
773 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 773 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
774 mShowAction->addTo( actionMenu ); 774 mShowAction->addTo( actionMenu );
775 connect( mShowAction, SIGNAL( activated() ), 775 connect( mShowAction, SIGNAL( activated() ),
776 mView, SLOT( showIncidence() ) ); 776 mView, SLOT( showIncidence() ) );
777 777
778 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 778 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
779 mEditAction->addTo( actionMenu ); 779 mEditAction->addTo( actionMenu );
780 connect( mEditAction, SIGNAL( activated() ), 780 connect( mEditAction, SIGNAL( activated() ),
781 mView, SLOT( editIncidence() ) ); 781 mView, SLOT( editIncidence() ) );
782 782
783 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 783 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
784 mDeleteAction->addTo( actionMenu ); 784 mDeleteAction->addTo( actionMenu );
785 connect( mDeleteAction, SIGNAL( activated() ), 785 connect( mDeleteAction, SIGNAL( activated() ),
786 mView, SLOT( deleteIncidence() ) ); 786 mView, SLOT( deleteIncidence() ) );
787 787
788 788
789 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 789 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
790 mCloneAction->addTo( actionMenu ); 790 mCloneAction->addTo( actionMenu );
791 connect( mCloneAction, SIGNAL( activated() ), 791 connect( mCloneAction, SIGNAL( activated() ),
792 mView, SLOT( cloneIncidence() ) ); 792 mView, SLOT( cloneIncidence() ) );
793 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 793 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
794 mMoveAction->addTo( actionMenu ); 794 mMoveAction->addTo( actionMenu );
795 connect( mMoveAction, SIGNAL( activated() ), 795 connect( mMoveAction, SIGNAL( activated() ),
796 mView, SLOT( moveIncidence() ) ); 796 mView, SLOT( moveIncidence() ) );
797 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 797 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
798 mBeamAction->addTo( actionMenu ); 798 mBeamAction->addTo( actionMenu );
799 connect( mBeamAction, SIGNAL( activated() ), 799 connect( mBeamAction, SIGNAL( activated() ),
800 mView, SLOT( beamIncidence() ) ); 800 mView, SLOT( beamIncidence() ) );
801 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 801 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
802 mCancelAction->addTo( actionMenu ); 802 mCancelAction->addTo( actionMenu );
803 connect( mCancelAction, SIGNAL( activated() ), 803 connect( mCancelAction, SIGNAL( activated() ),
804 mView, SLOT( toggleCancelIncidence() ) ); 804 mView, SLOT( toggleCancelIncidence() ) );
805 805
806 actionMenu->insertSeparator(); 806 actionMenu->insertSeparator();
807 807
808 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 808 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
809 this ); 809 this );
810 action->addTo( actionMenu ); 810 action->addTo( actionMenu );
811 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 811 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
812 812
813 icon = loadPixmap( pathString + "search" ); 813 icon = loadPixmap( pathString + "search" );
814 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 814 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
815 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 815 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
816 search_action->addTo( actionMenu ); 816 search_action->addTo( actionMenu );
817 connect( search_action, SIGNAL( activated() ), 817 connect( search_action, SIGNAL( activated() ),
818 mView->dialogManager(), SLOT( showSearchDialog() ) ); 818 mView->dialogManager(), SLOT( showSearchDialog() ) );
819 819
820 820
821 821
822 if ( KOPrefs::instance()->mShowFullMenu ) { 822 if ( KOPrefs::instance()->mShowFullMenu ) {
823 actionMenu->insertSeparator(); 823 actionMenu->insertSeparator();
824 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 824 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
825 825
826 } 826 }
827 // actionMenu->insertSeparator(); 827 // actionMenu->insertSeparator();
828 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 828 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
829 this ); 829 this );
830 action->addTo( importMenu_X ); 830 action->addTo( importMenu_X );
831 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 831 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
832 action = new QAction( "import_quick", i18n("Import last file"), 0, 832 action = new QAction( "import_quick", i18n("Import last file"), 0,
833 this ); 833 this );
834 action->addTo( importMenu_X ); 834 action->addTo( importMenu_X );
835 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 835 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
836 importMenu_X->insertSeparator(); 836 importMenu_X->insertSeparator();
837 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 837 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
838 this ); 838 this );
839 action->addTo( importMenu_X ); 839 action->addTo( importMenu_X );
840 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 840 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
841 //#ifndef DESKTOP_VERSION 841 //#ifndef DESKTOP_VERSION
842 importMenu_X->insertSeparator(); 842 importMenu_X->insertSeparator();
843 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 843 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
844 this ); 844 this );
845 action->addTo( importMenu_X ); 845 action->addTo( importMenu_X );
846 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 846 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
847 //#else 847 //#else
848#ifdef _OL_IMPORT_ 848#ifdef _OL_IMPORT_
849 importMenu_X->insertSeparator(); 849 importMenu_X->insertSeparator();
850 action = new QAction( "import_ol", i18n("Import from OL"), 0, 850 action = new QAction( "import_ol", i18n("Import from OL"), 0,
851 this ); 851 this );
852 action->addTo( importMenu_X ); 852 action->addTo( importMenu_X );
853 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 853 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
854#endif 854#endif
855 //#endif 855 //#endif
856 856
857 //importMenu->insertSeparator(); 857 //importMenu->insertSeparator();
858 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 858 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
859 this ); 859 this );
860 action->addTo( importMenu ); 860 action->addTo( importMenu );
861 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 861 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
862 862
863 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 863 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
864 this ); 864 this );
865 action->addTo( importMenu ); 865 action->addTo( importMenu );
866 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 866 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
867 importMenu->insertSeparator(); 867 importMenu->insertSeparator();
868 importMenu->insertItem( i18n("Import"), importMenu_X ); 868 importMenu->insertItem( i18n("Import"), importMenu_X );
869 //importMenu->insertSeparator(); 869 //importMenu->insertSeparator();
870 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 870 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
871 this ); 871 this );
872 action->addTo( exportMenu_X ); 872 action->addTo( exportMenu_X );
873 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 873 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
874 874
875 875
876 //LR 876 //LR
877 QPopupMenu *ex2phone = new QPopupMenu( this ); 877 QPopupMenu *ex2phone = new QPopupMenu( this );
878 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 878 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
879 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 879 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
880 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 880 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
881 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 881 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
882 882
883 importMenu->insertItem( i18n("Export"), exportMenu_X ); 883 importMenu->insertItem( i18n("Export"), exportMenu_X );
884#ifndef DESKTOP_VERSION 884#ifndef DESKTOP_VERSION
885 //importMenu->insertSeparator(); 885 //importMenu->insertSeparator();
886 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 886 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
887 this ); 887 this );
888 brAction->addTo( beamMenu_X ); 888 brAction->addTo( beamMenu_X );
889 brAction->setToggleAction (true ) ; 889 brAction->setToggleAction (true ) ;
890 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 890 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
891 891
892 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 892 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
893 this ); 893 this );
894 action->addTo( beamMenu_X ); 894 action->addTo( beamMenu_X );
895 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 895 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
896 896
897 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 897 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
898 this ); 898 this );
899 action->addTo( beamMenu_X ); 899 action->addTo( beamMenu_X );
900 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 900 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
901 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 901 importMenu->insertItem( i18n("Beam"), beamMenu_X );
902#else 902#else
903 //importMenu->insertSeparator(); 903 //importMenu->insertSeparator();
904 icon = loadPixmap( pathString + "print" ); 904 icon = loadPixmap( pathString + "print" );
905 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 905 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
906 action->addTo( beamMenu_X ); 906 action->addTo( beamMenu_X );
907 connect( action, SIGNAL( activated() ), 907 connect( action, SIGNAL( activated() ),
908 this, SLOT( printCal() ) ); 908 this, SLOT( printCal() ) );
909 909
910 icon = loadPixmap( pathString + "print" ); 910 icon = loadPixmap( pathString + "print" );
911 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 911 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
912 action->addTo( beamMenu_X ); 912 action->addTo( beamMenu_X );
913 connect( action, SIGNAL( activated() ), 913 connect( action, SIGNAL( activated() ),
914 this, SLOT( printSel() ) ); 914 this, SLOT( printSel() ) );
915 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 915 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
916 action->addTo( beamMenu_X ); 916 action->addTo( beamMenu_X );
917 connect( action, SIGNAL( activated() ), 917 connect( action, SIGNAL( activated() ),
918 mView->viewManager(), SIGNAL( printWNV() ) ); 918 mView->viewManager(), SIGNAL( printWNV() ) );
919 importMenu->insertItem( i18n("Print"), beamMenu_X ); 919 importMenu->insertItem( i18n("Print"), beamMenu_X );
920#endif 920#endif
921 importMenu->insertSeparator(); 921 importMenu->insertSeparator();
922 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 922 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
923 this ); 923 this );
924 action->addTo( importMenu ); 924 action->addTo( importMenu );
925 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 925 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
926 importMenu->insertSeparator(); 926 importMenu->insertSeparator();
927 action = new QAction( "beam all", i18n("Save"), 0, 927 action = new QAction( "beam all", i18n("Save"), 0,
928 this ); 928 this );
929 action->addTo( importMenu ); 929 action->addTo( importMenu );
930 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 930 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
931 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 931 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
932 this ); 932 this );
933 action->addTo( importMenu ); 933 action->addTo( importMenu );
934 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 934 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
935 935
936 //menuBar->insertItem( "Configure",configureMenu ); 936 //menuBar->insertItem( "Configure",configureMenu );
937 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 937 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
938 icon = loadPixmap( "korganizer/korganizer" ); 938 icon = loadPixmap( "korganizer/korganizer" );
939 939
940 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 940 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
941 action->addTo( helpMenu ); 941 action->addTo( helpMenu );
942 connect( action, SIGNAL( activated() ), 942 connect( action, SIGNAL( activated() ),
943 SLOT( whatsNew() ) ); 943 SLOT( whatsNew() ) );
944 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 944 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
945 action->addTo( helpMenu ); 945 action->addTo( helpMenu );
946 connect( action, SIGNAL( activated() ), 946 connect( action, SIGNAL( activated() ),
947 SLOT( features() ) ); 947 SLOT( features() ) );
948 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 948 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
949 action->addTo( helpMenu ); 949 action->addTo( helpMenu );
950 connect( action, SIGNAL( activated() ), 950 connect( action, SIGNAL( activated() ),
951 SLOT( keyBindings() ) ); 951 SLOT( keyBindings() ) );
952 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 952 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
953 action->addTo( helpMenu ); 953 action->addTo( helpMenu );
954 connect( action, SIGNAL( activated() ), 954 connect( action, SIGNAL( activated() ),
955 SLOT( synchowto() ) ); 955 SLOT( synchowto() ) );
956 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 956 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
957 action->addTo( helpMenu ); 957 action->addTo( helpMenu );
958 connect( action, SIGNAL( activated() ), 958 connect( action, SIGNAL( activated() ),
959 SLOT( kdesynchowto() ) ); 959 SLOT( kdesynchowto() ) );
960 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 960 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
961 action->addTo( helpMenu ); 961 action->addTo( helpMenu );
962 connect( action, SIGNAL( activated() ), 962 connect( action, SIGNAL( activated() ),
963 SLOT( multisynchowto() ) ); 963 SLOT( multisynchowto() ) );
964 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 964 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
965 action->addTo( helpMenu ); 965 action->addTo( helpMenu );
966 connect( action, SIGNAL( activated() ), 966 connect( action, SIGNAL( activated() ),
967 SLOT( aboutAutoSaving() ) ); 967 SLOT( aboutAutoSaving() ) );
968 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 968 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
969 action->addTo( helpMenu ); 969 action->addTo( helpMenu );
970 connect( action, SIGNAL( activated() ), 970 connect( action, SIGNAL( activated() ),
971 SLOT( aboutKnownBugs() ) ); 971 SLOT( aboutKnownBugs() ) );
972 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 972 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
973 action->addTo( helpMenu ); 973 action->addTo( helpMenu );
974 connect( action, SIGNAL( activated() ), 974 connect( action, SIGNAL( activated() ),
975 SLOT( usertrans() ) ); 975 SLOT( usertrans() ) );
976 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 976 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
977 action->addTo( helpMenu ); 977 action->addTo( helpMenu );
978 connect( action, SIGNAL( activated() ), 978 connect( action, SIGNAL( activated() ),
979 SLOT( faq() ) ); 979 SLOT( faq() ) );
980 action = new QAction( "licence", i18n("Licence..."), 0, this ); 980 action = new QAction( "licence", i18n("Licence..."), 0, this );
981 action->addTo( helpMenu ); 981 action->addTo( helpMenu );
982 connect( action, SIGNAL( activated() ), 982 connect( action, SIGNAL( activated() ),
983 SLOT( licence() ) ); 983 SLOT( licence() ) );
984 action = new QAction( "about", i18n("About..."), 0, this ); 984 action = new QAction( "about", i18n("About..."), 0, this );
985 action->addTo( helpMenu ); 985 action->addTo( helpMenu );
986 connect( action, SIGNAL( activated() ), 986 connect( action, SIGNAL( activated() ),
987 SLOT( about() ) ); 987 SLOT( about() ) );
988 //menuBar->insertSeparator(); 988 //menuBar->insertSeparator();
989 989
990 // ****************************************************** 990 // ******************************************************
991 // menubar icons 991 // menubar icons
992 992
993 993
994 iconToolBar->setHorizontalStretchable (true ); 994 iconToolBar->setHorizontalStretchable (true );
995 //menuBar->insertItem( iconToolBar ); 995 //menuBar->insertItem( iconToolBar );
996 //xdays_action 996 //xdays_action
997 if (p-> mShowIconNewEvent) 997 if (p-> mShowIconNewEvent)
998 ne_action->addTo( iconToolBar ); 998 ne_action->addTo( iconToolBar );
999 if (p->mShowIconNewTodo ) 999 if (p->mShowIconNewTodo )
1000 nt_action->addTo( iconToolBar ); 1000 nt_action->addTo( iconToolBar );
1001 if (p-> mShowIconSearch) 1001 if (p-> mShowIconSearch)
1002 search_action->addTo( iconToolBar ); 1002 search_action->addTo( iconToolBar );
1003 if (p-> mShowIconNext) 1003 if (p-> mShowIconNext)
1004 whatsnext_action->addTo( iconToolBar ); 1004 whatsnext_action->addTo( iconToolBar );
1005 if (p-> mShowIconNextDays) 1005 if (p-> mShowIconNextDays)
1006 xdays_action->addTo( iconToolBar ); 1006 xdays_action->addTo( iconToolBar );
1007 if (p-> mShowIconList) 1007 if (p-> mShowIconList)
1008 showlist_action->addTo( iconToolBar ); 1008 showlist_action->addTo( iconToolBar );
1009 if (p-> mShowIconDay1) 1009 if (p-> mShowIconDay1)
1010 day1_action->addTo( iconToolBar ); 1010 day1_action->addTo( iconToolBar );
1011 if (p-> mShowIconDay5) 1011 if (p-> mShowIconDay5)
1012 day5_action->addTo( iconToolBar ); 1012 day5_action->addTo( iconToolBar );
1013 if (p-> mShowIconDay7) 1013 if (p-> mShowIconDay7)
1014 day7_action->addTo( iconToolBar ); 1014 day7_action->addTo( iconToolBar );
1015 if (p-> mShowIconDay6) 1015 if (p-> mShowIconDay6)
1016 day6_action->addTo( iconToolBar ); 1016 day6_action->addTo( iconToolBar );
1017 if (p-> mShowIconMonth) 1017 if (p-> mShowIconMonth)
1018 month_action->addTo( iconToolBar ); 1018 month_action->addTo( iconToolBar );
1019 if (p-> mShowIconTodoview) 1019 if (p-> mShowIconTodoview)
1020 todoview_action->addTo( iconToolBar ); 1020 todoview_action->addTo( iconToolBar );
1021 if (p-> mShowIconJournal) 1021 if (p-> mShowIconJournal)
1022 viewjournal_action->addTo( iconToolBar ); 1022 viewjournal_action->addTo( iconToolBar );
1023 icon = loadPixmap( pathString + "2leftarrowB" ); 1023 icon = loadPixmap( pathString + "2leftarrowB" );
1024 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 1024 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
1025 if (p-> mShowIconBackFast) { 1025 if (p-> mShowIconBackFast) {
1026 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1026 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1027 connect( action, SIGNAL( activated() ), 1027 connect( action, SIGNAL( activated() ),
1028 mView, SLOT( goPreviousMonth() ) ); 1028 mView, SLOT( goPreviousMonth() ) );
1029 action->addTo( iconToolBar ); 1029 action->addTo( iconToolBar );
1030 } 1030 }
1031 icon = loadPixmap( pathString + "1leftarrowB" ); 1031 icon = loadPixmap( pathString + "1leftarrowB" );
1032 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 1032 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
1033 if (p-> mShowIconBack) { 1033 if (p-> mShowIconBack) {
1034 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1034 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1035 connect( action, SIGNAL( activated() ), 1035 connect( action, SIGNAL( activated() ),
1036 mView, SLOT( goPrevious() ) ); 1036 mView, SLOT( goPrevious() ) );
1037 action->addTo( iconToolBar ); 1037 action->addTo( iconToolBar );
1038 } 1038 }
1039 icon = loadPixmap( pathString + "today" ); 1039 icon = loadPixmap( pathString + "today" );
1040 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1040 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1041 if (p-> mShowIconToday) 1041 if (p-> mShowIconToday)
1042 today_action->addTo( iconToolBar ); 1042 today_action->addTo( iconToolBar );
1043 icon = loadPixmap( pathString + "1rightarrowB" ); 1043 icon = loadPixmap( pathString + "1rightarrowB" );
1044 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1044 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1045 if (p-> mShowIconForward) { 1045 if (p-> mShowIconForward) {
1046 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1046 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1047 connect( action, SIGNAL( activated() ), 1047 connect( action, SIGNAL( activated() ),
1048 mView, SLOT( goNext() ) ); 1048 mView, SLOT( goNext() ) );
1049 action->addTo( iconToolBar ); 1049 action->addTo( iconToolBar );
1050 } 1050 }
1051 icon = loadPixmap( pathString + "2rightarrowB" ); 1051 icon = loadPixmap( pathString + "2rightarrowB" );
1052 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1052 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1053 if (p-> mShowIconForwardFast) { 1053 if (p-> mShowIconForwardFast) {
1054 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1054 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1055 connect( action, SIGNAL( activated() ), 1055 connect( action, SIGNAL( activated() ),
1056 mView, SLOT( goNextMonth() ) ); 1056 mView, SLOT( goNextMonth() ) );
1057 action->addTo( iconToolBar ); 1057 action->addTo( iconToolBar );
1058 } 1058 }
1059 1059
1060 1060
1061 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 1061 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
1062 1062
1063 if (p-> mShowIconNewEvent) 1063 if (p-> mShowIconNewEvent)
1064 configureToolBarMenu->setItemChecked( 10, true ); 1064 configureToolBarMenu->setItemChecked( 10, true );
1065 if (p->mShowIconNewTodo ) 1065 if (p->mShowIconNewTodo )
1066 configureToolBarMenu->setItemChecked( 20, true ); 1066 configureToolBarMenu->setItemChecked( 20, true );
1067 if (p-> mShowIconSearch) 1067 if (p-> mShowIconSearch)
1068 configureToolBarMenu->setItemChecked( 120, true ); 1068 configureToolBarMenu->setItemChecked( 120, true );
1069 if (p-> mShowIconList) 1069 if (p-> mShowIconList)
1070 configureToolBarMenu->setItemChecked( 30, true ); 1070 configureToolBarMenu->setItemChecked( 30, true );
1071 if (p-> mShowIconDay1) 1071 if (p-> mShowIconDay1)
1072 configureToolBarMenu->setItemChecked( 40, true ); 1072 configureToolBarMenu->setItemChecked( 40, true );
1073 if (p-> mShowIconDay5) 1073 if (p-> mShowIconDay5)
1074 configureToolBarMenu->setItemChecked( 50, true ); 1074 configureToolBarMenu->setItemChecked( 50, true );
1075 if (p-> mShowIconDay6) 1075 if (p-> mShowIconDay6)
1076 configureToolBarMenu->setItemChecked( 75, true ); 1076 configureToolBarMenu->setItemChecked( 75, true );
1077 if (p-> mShowIconDay7) 1077 if (p-> mShowIconDay7)
1078 configureToolBarMenu->setItemChecked( 60, true ); 1078 configureToolBarMenu->setItemChecked( 60, true );
1079 if (p-> mShowIconMonth) 1079 if (p-> mShowIconMonth)
1080 configureToolBarMenu->setItemChecked( 70, true ); 1080 configureToolBarMenu->setItemChecked( 70, true );
1081 if (p-> mShowIconTodoview) 1081 if (p-> mShowIconTodoview)
1082 configureToolBarMenu->setItemChecked( 80, true ); 1082 configureToolBarMenu->setItemChecked( 80, true );
1083 if (p-> mShowIconBackFast) 1083 if (p-> mShowIconBackFast)
1084 configureToolBarMenu->setItemChecked( 200, true ); 1084 configureToolBarMenu->setItemChecked( 200, true );
1085 if (p-> mShowIconBack) 1085 if (p-> mShowIconBack)
1086 configureToolBarMenu->setItemChecked( 210, true ); 1086 configureToolBarMenu->setItemChecked( 210, true );
1087 if (p-> mShowIconToday) 1087 if (p-> mShowIconToday)
1088 configureToolBarMenu->setItemChecked( 130, true ); 1088 configureToolBarMenu->setItemChecked( 130, true );
1089 if (p-> mShowIconForward) 1089 if (p-> mShowIconForward)
1090 configureToolBarMenu->setItemChecked( 220, true ); 1090 configureToolBarMenu->setItemChecked( 220, true );
1091 if (p-> mShowIconForwardFast) 1091 if (p-> mShowIconForwardFast)
1092 configureToolBarMenu->setItemChecked( 230, true ); 1092 configureToolBarMenu->setItemChecked( 230, true );
1093 if (p-> mShowIconNextDays) 1093 if (p-> mShowIconNextDays)
1094 configureToolBarMenu->setItemChecked( 100, true ); 1094 configureToolBarMenu->setItemChecked( 100, true );
1095 if (p-> mShowIconNext) 1095 if (p-> mShowIconNext)
1096 configureToolBarMenu->setItemChecked( 110, true ); 1096 configureToolBarMenu->setItemChecked( 110, true );
1097 if (p-> mShowIconJournal) 1097 if (p-> mShowIconJournal)
1098 configureToolBarMenu->setItemChecked( 90, true ); 1098 configureToolBarMenu->setItemChecked( 90, true );
1099 if (p-> mShowIconWhatsThis) 1099 if (p-> mShowIconWhatsThis)
1100 configureToolBarMenu->setItemChecked( 300, true ); 1100 configureToolBarMenu->setItemChecked( 300, true );
1101 if (p-> mShowIconWeekNum) 1101 if (p-> mShowIconWeekNum)
1102 configureToolBarMenu->setItemChecked( 400, true ); 1102 configureToolBarMenu->setItemChecked( 400, true );
1103 QLabel* dummy = new QLabel( iconToolBar ); 1103 QLabel* dummy = new QLabel( iconToolBar );
1104 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1104 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1105 if (!p-> mShowIconStretch) 1105 if (!p-> mShowIconStretch)
1106 iconToolBar->setStretchableWidget ( dummy ) ; 1106 iconToolBar->setStretchableWidget ( dummy ) ;
1107 else 1107 else
1108 configureToolBarMenu->setItemChecked( 5, true ); 1108 configureToolBarMenu->setItemChecked( 5, true );
1109 if (p-> mShowIconWhatsThis) 1109 if (p-> mShowIconWhatsThis)
1110 QWhatsThis::whatsThisButton ( iconToolBar ); 1110 QWhatsThis::whatsThisButton ( iconToolBar );
1111 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1111 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1112 configureAgenda( p->mHourSize ); 1112 configureAgenda( p->mHourSize );
1113 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1113 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1114} 1114}
1115 1115
1116void MainWindow::exportToPhone( int mode ) 1116void MainWindow::exportToPhone( int mode )
1117{ 1117{
1118 1118
1119 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1119 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1120 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1120 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1121 KOex2phonePrefs ex2phone; 1121 KOex2phonePrefs ex2phone;
1122 1122
1123 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1123 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1124 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1124 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1125 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1125 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1126 if ( mode == 1 ) 1126 if ( mode == 1 )
1127 ex2phone.setCaption(i18n("Export complete calendar")); 1127 ex2phone.setCaption(i18n("Export complete calendar"));
1128 if ( mode == 2 ) 1128 if ( mode == 2 )
1129 ex2phone.setCaption(i18n("Export filtered calendar")); 1129 ex2phone.setCaption(i18n("Export filtered calendar"));
1130 1130
1131 if ( !ex2phone.exec() ) { 1131 if ( !ex2phone.exec() ) {
1132 return; 1132 return;
1133 } 1133 }
1134 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1134 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1135 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1135 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1136 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1136 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1137 1137
1138 int inFuture = 0; 1138 int inFuture = 0;
1139 if ( ex2phone.mWriteBackFuture->isChecked() ) 1139 if ( ex2phone.mWriteBackFuture->isChecked() )
1140 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1140 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1141 QPtrList<Incidence> delSel; 1141 QPtrList<Incidence> delSel;
1142 if ( mode == 1 ) 1142 if ( mode == 1 )
1143 delSel = mCalendar->rawIncidences(); 1143 delSel = mCalendar->rawIncidences();
1144 if ( mode == 2 ) 1144 if ( mode == 2 )
1145 delSel = mCalendar->incidences(); 1145 delSel = mCalendar->incidences();
1146 CalendarLocal* cal = new CalendarLocal(); 1146 CalendarLocal* cal = new CalendarLocal();
1147 cal->setLocalTime(); 1147 cal->setLocalTime();
1148 Incidence *incidence = delSel.first(); 1148 Incidence *incidence = delSel.first();
1149 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1149 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1150 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1150 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1151 while ( incidence ) { 1151 while ( incidence ) {
1152 if ( incidence->type() != "Journal" ) { 1152 if ( incidence->type() != "Journal" ) {
1153 bool add = true; 1153 bool add = true;
1154 if ( inFuture ) { 1154 if ( inFuture ) {
1155 QDateTime dt; 1155 QDateTime dt;
1156 if ( incidence->type() == "Todo" ) { 1156 if ( incidence->type() == "Todo" ) {
1157 Todo * t = (Todo*)incidence; 1157 Todo * t = (Todo*)incidence;
1158 if ( t->hasDueDate() ) 1158 if ( t->hasDueDate() )
1159 dt = t->dtDue(); 1159 dt = t->dtDue();
1160 else 1160 else
1161 dt = cur.addSecs( 62 ); 1161 dt = cur.addSecs( 62 );
1162 } 1162 }
1163 else { 1163 else {
1164 bool ok; 1164 bool ok;
1165 dt = incidence->getNextOccurence( cur, &ok ); 1165 dt = incidence->getNextOccurence( cur, &ok );
1166 if ( !ok ) 1166 if ( !ok )
1167 dt = cur.addSecs( -62 ); 1167 dt = cur.addSecs( -62 );
1168 } 1168 }
1169 if ( dt < cur || dt > end ) { 1169 if ( dt < cur || dt > end ) {
1170 add = false; 1170 add = false;
1171 } 1171 }
1172 } 1172 }
1173 if ( add ) { 1173 if ( add ) {
1174 Incidence *in = incidence->clone(); 1174 Incidence *in = incidence->clone();
1175 cal->addIncidence( in ); 1175 cal->addIncidence( in );
1176 } 1176 }
1177 } 1177 }
1178 incidence = delSel.next(); 1178 incidence = delSel.next();
1179 } 1179 }
1180 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1180 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1181 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1181 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1182 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1182 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1183 1183
1184 setCaption( i18n("Writing to phone...")); 1184 setCaption( i18n("Writing to phone..."));
1185 if ( PhoneFormat::writeToPhone( cal ) ) 1185 if ( PhoneFormat::writeToPhone( cal ) )
1186 setCaption( i18n("Export to phone successful!")); 1186 setCaption( i18n("Export to phone successful!"));
1187 else 1187 else
1188 setCaption( i18n("Error exporting to phone!")); 1188 setCaption( i18n("Error exporting to phone!"));
1189 delete cal; 1189 delete cal;
1190} 1190}
1191 1191
1192 1192
1193void MainWindow::setDefaultPreferences() 1193void MainWindow::setDefaultPreferences()
1194{ 1194{
1195 KOPrefs *p = KOPrefs::instance(); 1195 KOPrefs *p = KOPrefs::instance();
1196 1196
1197 p->mCompactDialogs = true; 1197 p->mCompactDialogs = true;
1198 p->mConfirm = true; 1198 p->mConfirm = true;
1199 // p->mEnableQuickTodo = false; 1199 // p->mEnableQuickTodo = false;
1200 1200
1201} 1201}
1202 1202
1203QString MainWindow::resourcePath() 1203QString MainWindow::resourcePath()
1204{ 1204{
1205 return KGlobal::iconLoader()->iconPath(); 1205 return KGlobal::iconLoader()->iconPath();
1206} 1206}
1207 1207
1208void MainWindow::displayText( QString text ,QString cap ) 1208void MainWindow::displayText( QString text ,QString cap )
1209{ 1209{
1210 QDialog dia( this, "name", true ); ; 1210 QDialog dia( this, "name", true ); ;
1211 dia.setCaption( cap ); 1211 dia.setCaption( cap );
1212 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1212 QVBoxLayout* lay = new QVBoxLayout( &dia );
1213 lay->setSpacing( 3 ); 1213 lay->setSpacing( 3 );
1214 lay->setMargin( 3 ); 1214 lay->setMargin( 3 );
1215 QTextBrowser tb ( &dia ); 1215 QTextBrowser tb ( &dia );
1216 lay->addWidget( &tb ); 1216 lay->addWidget( &tb );
1217 tb.setText( text ); 1217 tb.setText( text );
1218#ifdef DESKTOP_VERSION 1218#ifdef DESKTOP_VERSION
1219 dia.resize( 640, 480); 1219 dia.resize( 640, 480);
1220#else 1220#else
1221 dia.showMaximized(); 1221 dia.showMaximized();
1222#endif 1222#endif
1223 dia.exec(); 1223 dia.exec();
1224} 1224}
1225 1225
1226void MainWindow::features() 1226void MainWindow::features()
1227{ 1227{
1228 1228
1229 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1229 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1230} 1230}
1231 1231
1232void MainWindow::usertrans() 1232void MainWindow::usertrans()
1233{ 1233{
1234 1234
1235 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1235 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1236} 1236}
1237 1237
1238void MainWindow::kdesynchowto() 1238void MainWindow::kdesynchowto()
1239{ 1239{
1240 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1240 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1241} 1241}
1242void MainWindow::multisynchowto() 1242void MainWindow::multisynchowto()
1243{ 1243{
1244 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1244 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1245} 1245}
1246void MainWindow::synchowto() 1246void MainWindow::synchowto()
1247{ 1247{
1248 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1248 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1249} 1249}
1250void MainWindow::faq() 1250void MainWindow::faq()
1251{ 1251{
1252 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1252 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1253 1253
1254} 1254}
1255void MainWindow::whatsNew() 1255void MainWindow::whatsNew()
1256{ 1256{
1257 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1257 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1258 1258
1259} 1259}
1260void MainWindow::licence() 1260void MainWindow::licence()
1261{ 1261{
1262 KApplication::showLicence(); 1262 KApplication::showLicence();
1263 1263
1264} 1264}
1265void MainWindow::about() 1265void MainWindow::about()
1266{ 1266{
1267 QString version; 1267 QString version;
1268#include <../version> 1268#include <../version>
1269 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1269 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1270 i18n("KOrganizer/Platform-independent\n") + 1270 i18n("KOrganizer/Platform-independent\n") +
1271 "(KO/Pi) " + version + " - " + 1271 "(KO/Pi) " + version + " - " +
1272 1272
1273#ifdef DESKTOP_VERSION 1273#ifdef DESKTOP_VERSION
1274 i18n("Desktop Edition\n") + 1274 i18n("Desktop Edition\n") +
1275#else 1275#else
1276 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1276 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1277#endif 1277#endif
1278 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.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1278 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!") );
1279} 1279}
1280void MainWindow::keyBindings() 1280void MainWindow::keyBindings()
1281{ 1281{
1282 QString cap = i18n("KO/Pi Keys + Colors"); 1282 QString cap = i18n("KO/Pi Keys + Colors");
1283 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1283 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1284 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1284 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1285 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1285 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1286 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1286 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1287 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1287 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1288 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1288 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1289 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1289 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1290 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1290 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1291 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1291 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1292 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1292 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1293 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1293 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1294 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1294 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1295 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1295 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1296 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1296 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1297 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1297 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1298 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1298 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1299 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1299 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1300 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1300 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1301 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1301 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1302 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1302 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1303 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1303 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1304 i18n("<p><h3>In agenda view:</h3></p>\n") + 1304 i18n("<p><h3>In agenda view:</h3></p>\n") +
1305 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1305 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1306 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1306 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1307 i18n("<p><h3>In todo view:</h3></p>\n") + 1307 i18n("<p><h3>In todo view:</h3></p>\n") +
1308 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1308 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1309 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1309 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1310 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1310 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1311 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1311 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1312 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1312 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1313 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1313 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1314 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1314 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1315 i18n("<p><h3>In list view:</h3></p>\n") + 1315 i18n("<p><h3>In list view:</h3></p>\n") +
1316 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1316 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1317 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1317 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1318 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1318 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1319 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1319 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1320 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1320 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1321 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1321 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1322 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1322 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1323 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1323 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1324 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1324 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1325 i18n("<p><b>E</b>: Edit item</p>\n") + 1325 i18n("<p><b>E</b>: Edit item</p>\n") +
1326 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1326 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1327 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1327 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1328 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1328 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1329 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1329 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1330 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1330 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1331 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1331 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1332 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1332 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1333 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1333 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1334 i18n("<p><b>White</b>: Item readonly</p>\n"); 1334 i18n("<p><b>White</b>: Item readonly</p>\n");
1335 displayText( text, cap); 1335 displayText( text, cap);
1336} 1336}
1337void MainWindow::aboutAutoSaving() 1337void MainWindow::aboutAutoSaving()
1338{ 1338{
1339 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"); 1339 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");
1340 1340
1341 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1341 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1342 1342
1343} 1343}
1344void MainWindow::aboutKnownBugs() 1344void MainWindow::aboutKnownBugs()
1345{ 1345{
1346 QMessageBox* msg; 1346 QMessageBox* msg;
1347 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1347 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1348 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")+ 1348 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")+
1349 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1349 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1350 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1350 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1351 i18n("\nor report them in the bugtracker on\n") + 1351 i18n("\nor report them in the bugtracker on\n") +
1352 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1352 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1353 QMessageBox::NoIcon, 1353 QMessageBox::NoIcon,
1354 QMessageBox::Ok, 1354 QMessageBox::Ok,
1355 QMessageBox::NoButton, 1355 QMessageBox::NoButton,
1356 QMessageBox::NoButton); 1356 QMessageBox::NoButton);
1357 msg->exec(); 1357 msg->exec();
1358 delete msg; 1358 delete msg;
1359 1359
1360} 1360}
1361 1361
1362QString MainWindow::defaultFileName() 1362QString MainWindow::defaultFileName()
1363{ 1363{
1364 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1364 return locateLocal( "data", "korganizer/mycalendar.ics" );
1365} 1365}
1366QString MainWindow::syncFileName() 1366QString MainWindow::syncFileName()
1367{ 1367{
1368#ifdef DESKTOP_VERSION 1368#ifdef DESKTOP_VERSION
1369 return locateLocal( "tmp", "synccalendar.ics" ); 1369 return locateLocal( "tmp", "synccalendar.ics" );
1370#else 1370#else
1371 return QString( "/tmp/synccalendar.ics" ); 1371 return QString( "/tmp/synccalendar.ics" );
1372#endif 1372#endif
1373} 1373}
1374void MainWindow::updateWeek(QDate seda) 1374void MainWindow::updateWeek(QDate seda)
1375{ 1375{
1376 int weekNum = 0; 1376 int weekNum = 0;
1377 QDate d = QDate ( seda.year(), 1,1); 1377 QDate d = QDate ( seda.year(), 1,1);
1378 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday 1378 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday
1379 if ( seda.addDays(6).year() != seda.year() ) { 1379 if ( seda.addDays(6).year() != seda.year() ) {
1380 if ( seda.year() != d.year() ) { 1380 if ( seda.year() != d.year() ) {
1381 if ( d.dayOfWeek() > 4 ) 1381 if ( d.dayOfWeek() > 4 )
1382 d = QDate ( seda.year(), 1,1); 1382 d = QDate ( seda.year(), 1,1);
1383 else 1383 else
1384 weekNum = 1; 1384 weekNum = 1;
1385 } else { 1385 } else {
1386 QDate dd( seda.year()+1, 1,1); 1386 QDate dd( seda.year()+1, 1,1);
1387 if ( dd.dayOfWeek() <= 4 ) 1387 if ( dd.dayOfWeek() <= 4 )
1388 weekNum = 1; 1388 weekNum = 1;
1389 } 1389 }
1390 } 1390 }
1391 if ( weekNum == 0 ){ 1391 if ( weekNum == 0 ){
1392 int dow = d.dayOfWeek(); 1392 int dow = d.dayOfWeek();
1393 if ( dow <= 4 ) 1393 if ( dow <= 4 )
1394 d = d.addDays( 1-dow ); 1394 d = d.addDays( 1-dow );
1395 else // 5,6,7 1395 else // 5,6,7
1396 d = d.addDays( 8-dow ); 1396 d = d.addDays( 8-dow );
1397 // we have the first week of the year.we are on monday 1397 // we have the first week of the year.we are on monday
1398 weekNum = d.daysTo( seda ) / 7 +1; 1398 weekNum = d.daysTo( seda ) / 7 +1;
1399 } 1399 }
1400 1400
1401 mWeekPixmap.fill( mWeekBgColor ); 1401 mWeekPixmap.fill( mWeekBgColor );
1402 QPainter p ( &mWeekPixmap ); 1402 QPainter p ( &mWeekPixmap );
1403 p.setFont( mWeekFont ); 1403 p.setFont( mWeekFont );
1404 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1404 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1405 p.end(); 1405 p.end();
1406 QIconSet icon3 ( mWeekPixmap ); 1406 QIconSet icon3 ( mWeekPixmap );
1407 mWeekAction->setIconSet ( icon3 ); 1407 mWeekAction->setIconSet ( icon3 );
1408 1408
1409} 1409}
1410void MainWindow::updateWeekNum(const DateList &selectedDates) 1410void MainWindow::updateWeekNum(const DateList &selectedDates)
1411{ 1411{
1412 updateWeek( selectedDates.first() ); 1412 updateWeek( selectedDates.first() );
1413} 1413}
1414void MainWindow::processIncidenceSelection( Incidence *incidence ) 1414void MainWindow::processIncidenceSelection( Incidence *incidence )
1415{ 1415{
1416 1416
1417 if ( !incidence ) { 1417 if ( !incidence ) {
1418 enableIncidenceActions( false ); 1418 enableIncidenceActions( false );
1419 1419
1420 mNewSubTodoAction->setEnabled( false ); 1420 mNewSubTodoAction->setEnabled( false );
1421 setCaptionToDates(); 1421 setCaptionToDates();
1422 return; 1422 return;
1423 1423
1424 } 1424 }
1425 1425
1426 //KGlobal::locale()->formatDateTime(nextA, true); 1426 //KGlobal::locale()->formatDateTime(nextA, true);
1427 QString startString = ""; 1427 QString startString = "";
1428 if ( incidence->type() != "Todo" ) { 1428 if ( incidence->type() != "Todo" ) {
1429 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1429 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1430 if ( incidence->doesFloat() ) { 1430 if ( incidence->doesFloat() ) {
1431 startString += ": "+incidence->dtStartDateStr( true ); 1431 startString += ": "+incidence->dtStartDateStr( true );
1432 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1432 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1433 1433
1434 } else { 1434 } else {
1435 startString = ": "+incidence->dtStartStr(true); 1435 startString = ": "+incidence->dtStartStr(true);
1436 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1436 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1437 1437
1438 } 1438 }
1439 1439
1440 } else { 1440 } else {
1441 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1441 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1442 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1442 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1443 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1443 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1444 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1444 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1445 bool ok; 1445 bool ok;
1446 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1446 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1447 if ( ok ) { 1447 if ( ok ) {
1448 int years = noc.date().year() - incidence->dtStart().date().year(); 1448 int years = noc.date().year() - incidence->dtStart().date().year();
1449 startString += i18n(" (%1 y.)"). arg( years ); 1449 startString += i18n(" (%1 y.)"). arg( years );
1450 } 1450 }
1451 } 1451 }
1452 else 1452 else
1453 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1453 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1454 } 1454 }
1455 1455
1456 } 1456 }
1457 else 1457 else
1458 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1458 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1459 if ( !incidence->location().isEmpty() ) 1459 if ( !incidence->location().isEmpty() )
1460 startString += " (" +incidence->location()+")"; 1460 startString += " (" +incidence->location()+")";
1461 setCaption( incidence->summary()+startString); 1461 setCaption( incidence->summary()+startString);
1462 1462
1463 enableIncidenceActions( true ); 1463 enableIncidenceActions( true );
1464 1464
1465 if ( incidence->type() == "Event" ) { 1465 if ( incidence->type() == "Event" ) {
1466 mShowAction->setText( i18n("Show Event...") ); 1466 mShowAction->setText( i18n("Show Event...") );
1467 mEditAction->setText( i18n("Edit Event...") ); 1467 mEditAction->setText( i18n("Edit Event...") );
1468 mDeleteAction->setText( i18n("Delete Event...") ); 1468 mDeleteAction->setText( i18n("Delete Event...") );
1469 1469
1470 mNewSubTodoAction->setEnabled( false ); 1470 mNewSubTodoAction->setEnabled( false );
1471 } else if ( incidence->type() == "Todo" ) { 1471 } else if ( incidence->type() == "Todo" ) {
1472 mShowAction->setText( i18n("Show Todo...") ); 1472 mShowAction->setText( i18n("Show Todo...") );
1473 mEditAction->setText( i18n("Edit Todo...") ); 1473 mEditAction->setText( i18n("Edit Todo...") );
1474 mDeleteAction->setText( i18n("Delete Todo...") ); 1474 mDeleteAction->setText( i18n("Delete Todo...") );
1475 1475
1476 mNewSubTodoAction->setEnabled( true ); 1476 mNewSubTodoAction->setEnabled( true );
1477 } else { 1477 } else {
1478 mShowAction->setText( i18n("Show...") ); 1478 mShowAction->setText( i18n("Show...") );
1479 mShowAction->setText( i18n("Edit...") ); 1479 mShowAction->setText( i18n("Edit...") );
1480 mShowAction->setText( i18n("Delete...") ); 1480 mShowAction->setText( i18n("Delete...") );
1481 1481
1482 mNewSubTodoAction->setEnabled( false ); 1482 mNewSubTodoAction->setEnabled( false );
1483 } 1483 }
1484} 1484}
1485 1485
1486void MainWindow::enableIncidenceActions( bool enabled ) 1486void MainWindow::enableIncidenceActions( bool enabled )
1487{ 1487{
1488 mShowAction->setEnabled( enabled ); 1488 mShowAction->setEnabled( enabled );
1489 mEditAction->setEnabled( enabled ); 1489 mEditAction->setEnabled( enabled );
1490 mDeleteAction->setEnabled( enabled ); 1490 mDeleteAction->setEnabled( enabled );
1491 1491
1492 mCloneAction->setEnabled( enabled ); 1492 mCloneAction->setEnabled( enabled );
1493 mMoveAction->setEnabled( enabled ); 1493 mMoveAction->setEnabled( enabled );
1494 mBeamAction->setEnabled( enabled ); 1494 mBeamAction->setEnabled( enabled );
1495 mCancelAction->setEnabled( enabled ); 1495 mCancelAction->setEnabled( enabled );
1496} 1496}
1497 1497
1498void MainWindow::importOL() 1498void MainWindow::importOL()
1499{ 1499{
1500#ifdef _OL_IMPORT_ 1500#ifdef _OL_IMPORT_
1501 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1501 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1502 id->exec(); 1502 id->exec();
1503 delete id; 1503 delete id;
1504 mView->updateView(); 1504 mView->updateView();
1505#endif 1505#endif
1506} 1506}
1507void MainWindow::importBday() 1507void MainWindow::importBday()
1508{ 1508{
1509 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1509 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1510 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1510 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1511 i18n("Import!"), i18n("Cancel"), 0, 1511 i18n("Import!"), i18n("Cancel"), 0,
1512 0, 1 ); 1512 0, 1 );
1513 if ( result == 0 ) { 1513 if ( result == 0 ) {
1514 mView->importBday(); 1514 mView->importBday();
1515 1515
1516 } 1516 }
1517 1517
1518 1518
1519} 1519}
1520void MainWindow::importQtopia() 1520void MainWindow::importQtopia()
1521{ 1521{
1522 //#ifndef DESKTOP_VERSION 1522 //#ifndef DESKTOP_VERSION
1523 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"); 1523 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");
1524#ifdef DESKTOP_VERSION 1524#ifdef DESKTOP_VERSION
1525 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"); 1525 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");
1526#endif 1526#endif
1527 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1527 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1528 i18n("Import!"), i18n("Cancel"), 0, 1528 i18n("Import!"), i18n("Cancel"), 0,
1529 0, 1 ); 1529 0, 1 );
1530 if ( result == 0 ) { 1530 if ( result == 0 ) {
1531#ifndef DESKTOP_VERSION 1531#ifndef DESKTOP_VERSION
1532 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1532 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1533 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1533 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1534 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1534 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1535#else 1535#else
1536 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1536 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1537 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1537 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1538 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1538 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1539#endif 1539#endif
1540 mView->importQtopia( categories, datebook, todolist ); 1540 mView->importQtopia( categories, datebook, todolist );
1541 } 1541 }
1542#if 0 1542#if 0
1543 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1543 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1544 i18n("Not supported \non desktop!\n"), 1544 i18n("Not supported \non desktop!\n"),
1545 i18n("Ok"), i18n("Cancel"), 0, 1545 i18n("Ok"), i18n("Cancel"), 0,
1546 0, 1 ); 1546 0, 1 );
1547 1547
1548#endif 1548#endif
1549} 1549}
1550 1550
1551void MainWindow::saveOnClose() 1551void MainWindow::saveOnClose()
1552{ 1552{
1553 KOPrefs *p = KOPrefs::instance(); 1553 KOPrefs *p = KOPrefs::instance();
1554 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1554 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1555 p->mToolBarUp = iconToolBar->x() > width()/2 || 1555 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1556 iconToolBar->y() > height()/2; 1556 iconToolBar->y() > height()/2;
1557 mView->writeSettings(); 1557 mView->writeSettings();
1558 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1558 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1559 save(); 1559 save();
1560} 1560}
1561void MainWindow::slotModifiedChanged( bool changed ) 1561void MainWindow::slotModifiedChanged( bool changed )
1562{ 1562{
1563 if ( mBlockAtStartup ) 1563 if ( mBlockAtStartup )
1564 return; 1564 return;
1565 1565
1566 int msec; 1566 int msec;
1567 // we store the changes after 1 minute, 1567 // we store the changes after 1 minute,
1568 // and for safety reasons after 10 minutes again 1568 // and for safety reasons after 10 minutes again
1569 if ( !mSyncManager->blockSave() ) 1569 if ( !mSyncManager->blockSave() )
1570 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1570 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1571 else 1571 else
1572 msec = 1000 * 600; 1572 msec = 1000 * 600;
1573 mSaveTimer.start( msec, true ); // 1 minute 1573 mSaveTimer.start( msec, true ); // 1 minute
1574 qDebug("KO: Saving File in %d secs!", msec/1000); 1574 qDebug("KO: Saving File in %d secs!", msec/1000);
1575 mCalendarModifiedFlag = true; 1575 mCalendarModifiedFlag = true;
1576} 1576}
1577void MainWindow::saveStopTimer() 1577void MainWindow::saveStopTimer()
1578{ 1578{
1579 mSaveTimer.stop(); 1579 mSaveTimer.stop();
1580 if (mSaveTimer.isActive() ) 1580 if (mSaveTimer.isActive() )
1581 qDebug("ti active "); 1581 qDebug("ti active ");
1582 else 1582 else
1583 qDebug("KO: Save timer stopped"); 1583 qDebug("KO: Save timer stopped");
1584} 1584}
1585void MainWindow::save() 1585void MainWindow::save()
1586{ 1586{
1587 if ( !mCalendarModifiedFlag ) { 1587 if ( !mCalendarModifiedFlag ) {
1588 qDebug("KO: Calendar not modified. Nothing saved."); 1588 qDebug("KO: Calendar not modified. Nothing saved.");
1589 return; 1589 return;
1590 } 1590 }
1591 if ( mSyncManager->blockSave() ) 1591 if ( mSyncManager->blockSave() )
1592 return; 1592 return;
1593 mSyncManager->setBlockSave(true); 1593 mSyncManager->setBlockSave(true);
1594 if ( mView->checkFileVersion( defaultFileName()) ) { 1594 if ( mView->checkFileVersion( defaultFileName()) ) {
1595 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1595 QTime neededSaveTime = QDateTime::currentDateTime().time();
1596 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1596 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1597 qDebug("KO: Start saving data to file!"); 1597 qDebug("KO: Start saving data to file!");
1598 mView->saveCalendar( defaultFileName() ); 1598 mView->saveCalendar( defaultFileName() );
1599 mCalendarModifiedFlag = false; 1599 mCalendarModifiedFlag = false;
1600 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1600 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1601 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1601 qDebug("KO: Needed %d ms for saving.",msNeeded );
1602 QString savemes; 1602 QString savemes;
1603 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1603 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1604 setCaption(savemes); 1604 setCaption(savemes);
1605 } else 1605 } else
1606 setCaption(i18n("Saving cancelled!")); 1606 setCaption(i18n("Saving cancelled!"));
1607 mSyncManager->setBlockSave( false ); 1607 mSyncManager->setBlockSave( false );
1608} 1608}
1609 1609
1610void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1610void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1611{ 1611{
1612 if ( !e->isAutoRepeat() ) { 1612 if ( !e->isAutoRepeat() ) {
1613 mFlagKeyPressed = false; 1613 mFlagKeyPressed = false;
1614 } 1614 }
1615} 1615}
1616void MainWindow::keyPressEvent ( QKeyEvent * e ) 1616void MainWindow::keyPressEvent ( QKeyEvent * e )
1617{ 1617{
1618 qApp->processEvents(); 1618 qApp->processEvents();
1619 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1619 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1620 e->ignore(); 1620 e->ignore();
1621 // qDebug(" ignore %d",e->isAutoRepeat() ); 1621 // qDebug(" ignore %d",e->isAutoRepeat() );
1622 return; 1622 return;
1623 } 1623 }
1624 if (! e->isAutoRepeat() ) 1624 if (! e->isAutoRepeat() )
1625 mFlagKeyPressed = true; 1625 mFlagKeyPressed = true;
1626 KOPrefs *p = KOPrefs::instance(); 1626 KOPrefs *p = KOPrefs::instance();
1627 bool showSelectedDates = false; 1627 bool showSelectedDates = false;
1628 int size; 1628 int size;
1629 int pro = 0; 1629 int pro = 0;
1630 //qDebug("MainWindow::keyPressEvent "); 1630 //qDebug("MainWindow::keyPressEvent ");
1631 switch ( e->key() ) { 1631 switch ( e->key() ) {
1632 case Qt::Key_Right: 1632 case Qt::Key_Right:
1633 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1633 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1634 mView->goNextMonth(); 1634 mView->goNextMonth();
1635 else 1635 else
1636 mView->goNext(); 1636 mView->goNext();
1637 showSelectedDates = true; 1637 showSelectedDates = true;
1638 break; 1638 break;
1639 case Qt::Key_Left: 1639 case Qt::Key_Left:
1640 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1640 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1641 mView->goPreviousMonth(); 1641 mView->goPreviousMonth();
1642 else 1642 else
1643 mView->goPrevious(); 1643 mView->goPrevious();
1644 showSelectedDates = true; 1644 showSelectedDates = true;
1645 break; 1645 break;
1646 case Qt::Key_Down: 1646 case Qt::Key_Down:
1647 mView->viewManager()->agendaView()->scrollOneHourDown(); 1647 mView->viewManager()->agendaView()->scrollOneHourDown();
1648 break; 1648 break;
1649 case Qt::Key_Up: 1649 case Qt::Key_Up:
1650 mView->viewManager()->agendaView()->scrollOneHourUp(); 1650 mView->viewManager()->agendaView()->scrollOneHourUp();
1651 break; 1651 break;
1652 case Qt::Key_K: 1652 case Qt::Key_K:
1653 mView->viewManager()->showMonthViewWeek(); 1653 mView->viewManager()->showMonthViewWeek();
1654 break; 1654 break;
1655 case Qt::Key_I: 1655 case Qt::Key_I:
1656 mView->showIncidence(); 1656 mView->showIncidence();
1657 break; 1657 break;
1658 case Qt::Key_Delete: 1658 case Qt::Key_Delete:
1659 case Qt::Key_Backspace: 1659 case Qt::Key_Backspace:
1660 mView->deleteIncidence(); 1660 mView->deleteIncidence();
1661 break; 1661 break;
1662 case Qt::Key_D: 1662 case Qt::Key_D:
1663 mView->viewManager()->showDayView(); 1663 mView->viewManager()->showDayView();
1664 showSelectedDates = true; 1664 showSelectedDates = true;
1665 break; 1665 break;
1666 case Qt::Key_O: 1666 case Qt::Key_O:
1667 mView->toggleFilerEnabled( ); 1667 mView->toggleFilerEnabled( );
1668 break; 1668 break;
1669 case Qt::Key_0: 1669 case Qt::Key_0:
1670 case Qt::Key_1: 1670 case Qt::Key_1:
1671 case Qt::Key_2: 1671 case Qt::Key_2:
1672 case Qt::Key_3: 1672 case Qt::Key_3:
1673 case Qt::Key_4: 1673 case Qt::Key_4:
1674 case Qt::Key_5: 1674 case Qt::Key_5:
1675 case Qt::Key_6: 1675 case Qt::Key_6:
1676 case Qt::Key_7: 1676 case Qt::Key_7:
1677 case Qt::Key_8: 1677 case Qt::Key_8:
1678 case Qt::Key_9: 1678 case Qt::Key_9:
1679 pro = e->key()-48; 1679 pro = e->key()-48;
1680 if ( pro == 0 ) 1680 if ( pro == 0 )
1681 pro = 10; 1681 pro = 10;
1682 if ( e->state() == Qt::ControlButton) 1682 if ( e->state() == Qt::ControlButton)
1683 pro += 10; 1683 pro += 10;
1684 break; 1684 break;
1685 case Qt::Key_M: 1685 case Qt::Key_M:
1686 mView->viewManager()->showMonthView(); 1686 mView->viewManager()->showMonthView();
1687 showSelectedDates = true; 1687 showSelectedDates = true;
1688 break; 1688 break;
1689 case Qt::Key_Insert: 1689 case Qt::Key_Insert:
1690 mView->newEvent(); 1690 mView->newEvent();
1691 break; 1691 break;
1692 case Qt::Key_S : 1692 case Qt::Key_S :
1693 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1693 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1694 mView->newSubTodo(); 1694 mView->newSubTodo();
1695 else 1695 else
1696 mView->dialogManager()->showSearchDialog(); 1696 mView->dialogManager()->showSearchDialog();
1697 break; 1697 break;
1698 case Qt::Key_Y : 1698 case Qt::Key_Y :
1699 case Qt::Key_Z : 1699 case Qt::Key_Z :
1700 mView->viewManager()->showWorkWeekView(); 1700 mView->viewManager()->showWorkWeekView();
1701 showSelectedDates = true; 1701 showSelectedDates = true;
1702 break; 1702 break;
1703 case Qt::Key_U : 1703 case Qt::Key_U :
1704 mView->viewManager()->showWeekView(); 1704 mView->viewManager()->showWeekView();
1705 showSelectedDates = true; 1705 showSelectedDates = true;
1706 break; 1706 break;
1707 case Qt::Key_H : 1707 case Qt::Key_H :
1708 keyBindings(); 1708 keyBindings();
1709 break; 1709 break;
1710 case Qt::Key_W: 1710 case Qt::Key_W:
1711 mView->viewManager()->showWhatsNextView(); 1711 mView->viewManager()->showWhatsNextView();
1712 break; 1712 break;
1713 case Qt::Key_L: 1713 case Qt::Key_L:
1714 mView->viewManager()->showListView(); 1714 mView->viewManager()->showListView();
1715 break; 1715 break;
1716 case Qt::Key_N: 1716 case Qt::Key_N:
1717 mView->viewManager()->showNextXView(); 1717 mView->viewManager()->showNextXView();
1718 showSelectedDates = true; 1718 showSelectedDates = true;
1719 break; 1719 break;
1720 case Qt::Key_V: 1720 case Qt::Key_V:
1721 mView->viewManager()->showTodoView(); 1721 mView->viewManager()->showTodoView();
1722 break; 1722 break;
1723 case Qt::Key_C: 1723 case Qt::Key_C:
1724 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1724 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1725 break; 1725 break;
1726 case Qt::Key_P: 1726 case Qt::Key_P:
1727 mView->showDatePicker( ); 1727 mView->showDatePicker( );
1728 break; 1728 break;
1729 case Qt::Key_F: 1729 case Qt::Key_F:
1730 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1730 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1731 mView->editFilters(); 1731 mView->editFilters();
1732 else 1732 else
1733 mView->toggleFilter(); 1733 mView->toggleFilter();
1734 break; 1734 break;
1735 case Qt::Key_X: 1735 case Qt::Key_X:
1736 mView->toggleDateNavigatorWidget(); 1736 mView->toggleDateNavigatorWidget();
1737 break; 1737 break;
1738 case Qt::Key_Space: 1738 case Qt::Key_Space:
1739 mView->toggleExpand(); 1739 mView->toggleExpand();
1740 break; 1740 break;
1741 case Qt::Key_A: 1741 case Qt::Key_A:
1742 mView->toggleAllDaySize(); 1742 mView->toggleAllDaySize();
1743 break; 1743 break;
1744 case Qt::Key_T: 1744 case Qt::Key_T:
1745 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1745 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1746 mView->newTodo(); 1746 mView->newTodo();
1747 else { 1747 else {
1748 mView->goToday(); 1748 mView->goToday();
1749 showSelectedDates = true; 1749 showSelectedDates = true;
1750 } 1750 }
1751 break; 1751 break;
1752 case Qt::Key_J: 1752 case Qt::Key_J:
1753 mView->viewManager()->showJournalView(); 1753 mView->viewManager()->showJournalView();
1754 break; 1754 break;
1755 case Qt::Key_B: 1755 case Qt::Key_B:
1756 mView->editIncidenceDescription();; 1756 mView->editIncidenceDescription();;
1757 break; 1757 break;
1758 // case Qt::Key_Return: 1758 // case Qt::Key_Return:
1759 case Qt::Key_E: 1759 case Qt::Key_E:
1760 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1760 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1761 mView->newEvent(); 1761 mView->newEvent();
1762 else 1762 else
1763 mView->editIncidence(); 1763 mView->editIncidence();
1764 break; 1764 break;
1765 case Qt::Key_Plus: 1765 case Qt::Key_Plus:
1766 size = p->mHourSize +2; 1766 size = p->mHourSize +2;
1767 if ( size <= 22 ) 1767 if ( size <= 22 )
1768 configureAgenda( size ); 1768 configureAgenda( size );
1769 break; 1769 break;
1770 case Qt::Key_Minus: 1770 case Qt::Key_Minus:
1771 size = p->mHourSize - 2; 1771 size = p->mHourSize - 2;
1772 if ( size >= 4 ) 1772 if ( size >= 4 )
1773 configureAgenda( size ); 1773 configureAgenda( size );
1774 break; 1774 break;
1775 1775
1776 1776
1777 default: 1777 default:
1778 e->ignore(); 1778 e->ignore();
1779 } 1779 }
1780 if ( pro > 0 ) { 1780 if ( pro > 0 ) {
1781 mView->selectFilter( pro-1 ); 1781 mView->selectFilter( pro-1 );
1782 } 1782 }
1783 if ( showSelectedDates ) { 1783 if ( showSelectedDates ) {
1784 ;// setCaptionToDates(); 1784 ;// setCaptionToDates();
1785 } 1785 }
1786 1786
1787} 1787}
1788 1788
1789void MainWindow::fillFilterMenu() 1789void MainWindow::fillFilterMenu()
1790{ 1790{
1791 selectFilterMenu->clear(); 1791 selectFilterMenu->clear();
1792 bool disable = false; 1792 bool disable = false;
1793 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1793 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1794 selectFilterMenu->insertSeparator(); 1794 selectFilterMenu->insertSeparator();
1795 if ( mView->filterView()->filtersEnabled() ) { 1795 if ( mView->filterView()->filtersEnabled() ) {
1796 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1796 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1797 } 1797 }
1798 else { 1798 else {
1799 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); 1799 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1800 disable = true; 1800 disable = true;
1801 } 1801 }
1802 selectFilterMenu->insertSeparator(); 1802 selectFilterMenu->insertSeparator();
1803 QPtrList<CalFilter> fili = mView->filters(); 1803 QPtrList<CalFilter> fili = mView->filters();
1804 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1804 CalFilter *curfilter = mView->filterView()->selectedFilter();
1805 CalFilter *filter = fili.first(); 1805 CalFilter *filter = fili.first();
1806 int iii = 2; 1806 int iii = 2;
1807 while(filter) { 1807 while(filter) {
1808 selectFilterMenu->insertItem( filter->name(), iii ); 1808 selectFilterMenu->insertItem( filter->name(), iii );
1809 if ( filter == curfilter) 1809 if ( filter == curfilter)
1810 selectFilterMenu->setItemChecked( iii, true ); 1810 selectFilterMenu->setItemChecked( iii, true );
1811 if ( disable ) 1811 if ( disable )
1812 selectFilterMenu->setItemEnabled( iii, false ); 1812 selectFilterMenu->setItemEnabled( iii, false );
1813 filter = fili.next(); 1813 filter = fili.next();
1814 ++iii; 1814 ++iii;
1815 } 1815 }
1816} 1816}
1817void MainWindow::selectFilter( int fil ) 1817void MainWindow::selectFilter( int fil )
1818{ 1818{
1819 if ( fil == 0 ) { 1819 if ( fil == 0 ) {
1820 mView->editFilters( ); 1820 mView->editFilters( );
1821 } else if ( fil == 1 ){ 1821 } else if ( fil == 1 ){
1822 mView->toggleFilerEnabled( ); 1822 mView->toggleFilerEnabled( );
1823 } else { 1823 } else {
1824 mView->selectFilter( fil-2 ); 1824 mView->selectFilter( fil-2 );
1825 } 1825 }
1826} 1826}
1827void MainWindow::configureToolBar( int item ) 1827void MainWindow::configureToolBar( int item )
1828{ 1828{
1829 1829
1830 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1830 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1831 KOPrefs *p = KOPrefs::instance(); 1831 KOPrefs *p = KOPrefs::instance();
1832 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1832 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1833 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1833 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1834 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1834 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1835 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1835 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1836 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1836 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1837 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1837 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1838 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1838 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1839 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 1839 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
1840 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1840 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1841 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1841 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1842 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1842 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1843 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1843 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1844 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1844 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1845 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1845 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1846 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1846 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1847 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1847 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1848 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1848 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1849 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1849 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1850 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1850 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1851 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1851 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1852 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 1852 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
1853 // initActions(); 1853 // initActions();
1854} 1854}
1855 1855
1856void MainWindow::setCaptionToDates() 1856void MainWindow::setCaptionToDates()
1857{ 1857{
1858 QString selDates; 1858 QString selDates;
1859 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1859 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1860 if (mView->startDate() < mView->endDate() ) 1860 if (mView->startDate() < mView->endDate() )
1861 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1861 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1862 else { 1862 else {
1863 QString addString; 1863 QString addString;
1864 if ( mView->startDate() == QDateTime::currentDateTime().date() ) 1864 if ( mView->startDate() == QDateTime::currentDateTime().date() )
1865 addString = i18n("Today"); 1865 addString = i18n("Today");
1866 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) 1866 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) )
1867 addString = i18n("Tomorrow"); 1867 addString = i18n("Tomorrow");
1868 if ( !addString.isEmpty() ) 1868 if ( !addString.isEmpty() )
1869 selDates = addString+", "+selDates ; 1869 selDates = addString+", "+selDates ;
1870 } 1870 }
1871 setCaption( i18n("Dates: ") + selDates ); 1871 setCaption( i18n("Dates: ") + selDates );
1872 1872
1873} 1873}
1874void MainWindow::showConfigureAgenda( ) 1874void MainWindow::showConfigureAgenda( )
1875{ 1875{
1876 int iii; 1876 int iii;
1877 for ( iii = 1;iii<= 10 ;++iii ){ 1877 for ( iii = 1;iii<= 10 ;++iii ){
1878 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 1878 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
1879 } 1879 }
1880 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 1880 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
1881} 1881}
1882void MainWindow::configureAgenda( int item ) 1882void MainWindow::configureAgenda( int item )
1883{ 1883{
1884 if ( KOPrefs::instance()->mHourSize == item ) 1884 if ( KOPrefs::instance()->mHourSize == item )
1885 return; 1885 return;
1886 KOPrefs::instance()->mHourSize=item; 1886 KOPrefs::instance()->mHourSize=item;
1887 mView->viewManager()->agendaView()->updateConfig(); 1887 mView->viewManager()->agendaView()->updateConfig();
1888} 1888}
1889 1889
1890void MainWindow::saveCalendar() 1890void MainWindow::saveCalendar()
1891{ 1891{
1892 QString fn = KOPrefs::instance()->mLastSaveFile; 1892 QString fn = KOPrefs::instance()->mLastSaveFile;
1893 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1893 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1894 1894
1895 if ( fn == "" ) 1895 if ( fn == "" )
1896 return; 1896 return;
1897 QFileInfo info; 1897 QFileInfo info;
1898 info.setFile( fn ); 1898 info.setFile( fn );
1899 QString mes; 1899 QString mes;
1900 bool createbup = true; 1900 bool createbup = true;
1901 if ( info. exists() ) { 1901 if ( info. exists() ) {
1902 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1902 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1903 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1903 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1904 i18n("Overwrite!"), i18n("Cancel"), 0, 1904 i18n("Overwrite!"), i18n("Cancel"), 0,
1905 0, 1 ); 1905 0, 1 );
1906 if ( result != 0 ) { 1906 if ( result != 0 ) {
1907 createbup = false; 1907 createbup = false;
1908 } 1908 }
1909 } 1909 }
1910 if ( createbup ) { 1910 if ( createbup ) {
1911 mView->saveCalendar( fn ); 1911 mView->saveCalendar( fn );
1912 mes = i18n("KO/Pi:Saved %1").arg(fn); 1912 mes = i18n("KO/Pi:Saved %1").arg(fn);
1913 KOPrefs::instance()->mLastSaveFile = fn; 1913 KOPrefs::instance()->mLastSaveFile = fn;
1914 setCaption(mes); 1914 setCaption(mes);
1915 } 1915 }
1916} 1916}
1917void MainWindow::loadCalendar() 1917void MainWindow::loadCalendar()
1918{ 1918{
1919 1919
1920 QString fn = KOPrefs::instance()->mLastLoadFile; 1920 QString fn = KOPrefs::instance()->mLastLoadFile;
1921 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1921 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1922 1922
1923 if ( fn == "" ) 1923 if ( fn == "" )
1924 return; 1924 return;
1925 QFileInfo info; 1925 QFileInfo info;
1926 info.setFile( fn ); 1926 info.setFile( fn );
1927 QString mess; 1927 QString mess;
1928 bool loadbup = true; 1928 bool loadbup = true;
1929 if ( info. exists() ) { 1929 if ( info. exists() ) {
1930 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1930 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1931 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1931 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1932 mess, 1932 mess,
1933 i18n("Load!"), i18n("Cancel"), 0, 1933 i18n("Load!"), i18n("Cancel"), 0,
1934 0, 1 ); 1934 0, 1 );
1935 if ( result != 0 ) { 1935 if ( result != 0 ) {
1936 loadbup = false; 1936 loadbup = false;
1937 } 1937 }
1938 } else { 1938 } else {
1939 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1939 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1940 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1940 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1941 0, 1 ); 1941 0, 1 );
1942 1942
1943 return; 1943 return;
1944 } 1944 }
1945 if ( loadbup ) { 1945 if ( loadbup ) {
1946 mView->openCalendar( fn ); 1946 mView->openCalendar( fn );
1947 KOPrefs::instance()->mLastLoadFile = fn; 1947 KOPrefs::instance()->mLastLoadFile = fn;
1948 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1948 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1949 setCaption(mess); 1949 setCaption(mess);
1950 } 1950 }
1951 1951
1952} 1952}
1953void MainWindow::quickImportIcal() 1953void MainWindow::quickImportIcal()
1954{ 1954{
1955 importFile( KOPrefs::instance()->mLastImportFile, false ); 1955 importFile( KOPrefs::instance()->mLastImportFile, false );
1956} 1956}
1957void MainWindow::importFile( QString fn, bool quick ) 1957void MainWindow::importFile( QString fn, bool quick )
1958{ 1958{
1959 QFileInfo info; 1959 QFileInfo info;
1960 info.setFile( fn ); 1960 info.setFile( fn );
1961 QString mess; 1961 QString mess;
1962 bool loadbup = true; 1962 bool loadbup = true;
1963 if ( !info. exists() ) { 1963 if ( !info. exists() ) {
1964 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1964 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1965 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1965 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1966 mess ); 1966 mess );
1967 return; 1967 return;
1968 } 1968 }
1969 int result = 0; 1969 int result = 0;
1970 if ( !quick ) { 1970 if ( !quick ) {
1971 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 )); 1971 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 ));
1972 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1972 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1973 mess, 1973 mess,
1974 "Import", "Cancel", 0, 1974 "Import", "Cancel", 0,
1975 0, 1 ); 1975 0, 1 );
1976 } 1976 }
1977 if ( result == 0 ) { 1977 if ( result == 0 ) {
1978 if ( mView->openCalendar( fn, true )) { 1978 if ( mView->openCalendar( fn, true )) {
1979 KOPrefs::instance()->mLastImportFile = fn; 1979 KOPrefs::instance()->mLastImportFile = fn;
1980 setCaption(i18n("Imported file successfully")); 1980 setCaption(i18n("Imported file successfully"));
1981 } else { 1981 } else {
1982 setCaption(i18n("Error importing file")); 1982 setCaption(i18n("Error importing file"));
1983 } 1983 }
1984 } 1984 }
1985} 1985}
1986 1986
1987void MainWindow::importIcal() 1987void MainWindow::importIcal()
1988{ 1988{
1989 1989
1990 QString fn =KOPrefs::instance()->mLastImportFile; 1990 QString fn =KOPrefs::instance()->mLastImportFile;
1991 1991
1992 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1992 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1993 if ( fn == "" ) 1993 if ( fn == "" )
1994 return; 1994 return;
1995 importFile( fn, true ); 1995 importFile( fn, true );
1996 1996
1997} 1997}
1998 1998
1999void MainWindow::exportVCalendar() 1999void MainWindow::exportVCalendar()
2000{ 2000{
2001 QString fn = KOPrefs::instance()->mLastVcalFile; 2001 QString fn = KOPrefs::instance()->mLastVcalFile;
2002 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2002 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2003 if ( fn == "" ) 2003 if ( fn == "" )
2004 return; 2004 return;
2005 QFileInfo info; 2005 QFileInfo info;
2006 info.setFile( fn ); 2006 info.setFile( fn );
2007 QString mes; 2007 QString mes;
2008 bool createbup = true; 2008 bool createbup = true;
2009 if ( info. exists() ) { 2009 if ( info. exists() ) {
2010 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2010 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2011 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2011 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2012 i18n("Overwrite!"), i18n("Cancel"), 0, 2012 i18n("Overwrite!"), i18n("Cancel"), 0,
2013 0, 1 ); 2013 0, 1 );
2014 if ( result != 0 ) { 2014 if ( result != 0 ) {
2015 createbup = false; 2015 createbup = false;
2016 } 2016 }
2017 } 2017 }
2018 if ( createbup ) { 2018 if ( createbup ) {
2019 if ( mView->exportVCalendar( fn ) ) { 2019 if ( mView->exportVCalendar( fn ) ) {
2020 KOPrefs::instance()->mLastVcalFile = fn; 2020 KOPrefs::instance()->mLastVcalFile = fn;
2021 if ( fn.length() > 20 ) 2021 if ( fn.length() > 20 )
2022 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2022 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2023 else 2023 else
2024 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2024 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2025 setCaption(mes); 2025 setCaption(mes);
2026 } 2026 }
2027 } 2027 }
2028 2028
2029} 2029}
2030QString MainWindow::sentSyncFile() 2030QString MainWindow::sentSyncFile()
2031{ 2031{
2032#ifdef DESKTOP_VERSION 2032#ifdef DESKTOP_VERSION
2033 return locateLocal( "tmp", "copysynccal.ics" ); 2033 return locateLocal( "tmp", "copysynccal.ics" );
2034#else 2034#else
2035 return QString( "/tmp/copysynccal.ics" ); 2035 return QString( "/tmp/copysynccal.ics" );
2036#endif 2036#endif
2037} 2037}
2038 2038
2039void MainWindow::syncFileRequest() 2039void MainWindow::syncFileRequest()
2040{ 2040{
2041 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2041 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2042 mSyncManager->slotSyncMenu( 999 ); 2042 mSyncManager->slotSyncMenu( 999 );
2043 } 2043 }
2044 2044
2045 setCaption(i18n("Saving Data to temp file ..." )); 2045 setCaption(i18n("Saving Data to temp file ..." ));
2046 mView->saveCalendar( sentSyncFile() ); 2046 mView->saveCalendar( sentSyncFile() );
2047 setCaption(i18n("Data saved to temp file!" )); 2047 setCaption(i18n("Data saved to temp file!" ));
2048 2048
2049} 2049}
2050void MainWindow::getFile( bool success ) 2050void MainWindow::getFile( bool success )
2051{ 2051{
2052 if ( ! success ) { 2052 if ( ! success ) {
2053 setCaption( i18n("Error receiving file. Nothing changed!") ); 2053 setCaption( i18n("Error receiving file. Nothing changed!") );
2054 return; 2054 return;
2055 } 2055 }
2056 mView->openCalendar( sentSyncFile() ); 2056 mView->openCalendar( sentSyncFile() );
2057 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2057 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2058 mSyncManager->slotSyncMenu( 999 ); 2058 mSyncManager->slotSyncMenu( 999 );
2059 } 2059 }
2060 setCaption( i18n("Pi-Sync successful!") ); 2060 setCaption( i18n("Pi-Sync successful!") );
2061} 2061}
2062 2062
2063void MainWindow::printSel( ) 2063void MainWindow::printSel( )
2064{ 2064{
2065 mView->viewManager()->agendaView()->agenda()->printSelection(); 2065 mView->viewManager()->agendaView()->agenda()->printSelection();
2066} 2066}
2067 2067
2068void MainWindow::printCal() 2068void MainWindow::printCal()
2069{ 2069{
2070 mView->print();//mCp->showDialog(); 2070 mView->print();//mCp->showDialog();
2071} 2071}
2072 2072
2073 2073
2074#include "libkdepim/kdatepicker.h" 2074#include "libkdepim/kdatepicker.h"
2075#include <kdatetbl.h> 2075#include <kdatetbl.h>
2076void MainWindow::weekAction() 2076void MainWindow::weekAction()
2077{ 2077{
2078 int month; 2078 int month;
2079 KPopupFrame* popup = new KPopupFrame(this); 2079 KPopupFrame* popup = new KPopupFrame(this);
2080 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2080 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2081 // ----- 2081 // -----
2082 picker->resize(picker->sizeHint()); 2082 picker->resize(picker->sizeHint());
2083 popup->setMainWidget(picker); 2083 popup->setMainWidget(picker);
2084 picker->setFocus(); 2084 picker->setFocus();
2085 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2085 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2086 int x = 0; 2086 int x = 0;
2087 int y = iconToolBar->height(); 2087 int y = iconToolBar->height();
2088 int dX = 0; 2088 int dX = 0;
2089 int dY = 0; 2089 int dY = 0;
2090 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2090 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2091 if ( iconToolBar->y() > height()/2 ) { 2091 if ( iconToolBar->y() > height()/2 ) {
2092 dY = picker->sizeHint().height()+8; 2092 dY = picker->sizeHint().height()+8;
2093 y = 0; 2093 y = 0;
2094 } 2094 }
2095 } else { 2095 } else {
2096 if ( iconToolBar->x() > width()/2 ) { // right side 2096 if ( iconToolBar->x() > width()/2 ) { // right side
2097 x=0; 2097 x=0;
2098 dX= picker->sizeHint().width()+8; 2098 dX= picker->sizeHint().width()+8;
2099 y = 0; 2099 y = 0;
2100 } else { 2100 } else {
2101 x= iconToolBar->width(); 2101 x= iconToolBar->width();
2102 y = 0; 2102 y = 0;
2103 } 2103 }
2104 } 2104 }
2105 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2105 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2106 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2106 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2107 { 2107 {
2108 month = picker->getResult(); 2108 month = picker->getResult();
2109 emit selectWeek ( month ); 2109 emit selectWeek ( month );
2110 //qDebug("weekSelected %d ", month); 2110 //qDebug("weekSelected %d ", month);
2111 } 2111 }
2112 delete popup; 2112 delete popup;
2113} 2113}