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