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