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