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