summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-09-19 00:01:34 (UTC)
committer zautrix <zautrix>2005-09-19 00:01:34 (UTC)
commitd73247ed44cab687a0d94a96ea7b3cf604b80ba0 (patch) (unidiff)
tree7e72ac8e0239163cfec8df67c0053e0cb3a8dd2f /korganizer
parent2d346e4052fd726e657daee4ac3f2bcc7103f5fb (diff)
downloadkdepimpi-d73247ed44cab687a0d94a96ea7b3cf604b80ba0.zip
kdepimpi-d73247ed44cab687a0d94a96ea7b3cf604b80ba0.tar.gz
kdepimpi-d73247ed44cab687a0d94a96ea7b3cf604b80ba0.tar.bz2
wn
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp3
1 files changed, 0 insertions, 3 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index fb0b4ad..1776dcc 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -40,790 +40,787 @@
40#include <libkdepim/phoneaccess.h> 40#include <libkdepim/phoneaccess.h>
41#include <libkcal/kincidenceformatter.h> 41#include <libkcal/kincidenceformatter.h>
42#include <libkdepim/kpimglobalprefs.h> 42#include <libkdepim/kpimglobalprefs.h>
43 43
44#include "calendarview.h" 44#include "calendarview.h"
45#include "koviewmanager.h" 45#include "koviewmanager.h"
46#include "datenavigator.h" 46#include "datenavigator.h"
47#include "koagendaview.h" 47#include "koagendaview.h"
48#include "kojournalview.h" 48#include "kojournalview.h"
49#include "koagenda.h" 49#include "koagenda.h"
50#include "kodialogmanager.h" 50#include "kodialogmanager.h"
51#include "kdialogbase.h" 51#include "kdialogbase.h"
52#include "kapplication.h" 52#include "kapplication.h"
53#include "kofilterview.h" 53#include "kofilterview.h"
54#include "kstandarddirs.h" 54#include "kstandarddirs.h"
55#include "koprefs.h" 55#include "koprefs.h"
56#include "kfiledialog.h" 56#include "kfiledialog.h"
57#include "koglobals.h" 57#include "koglobals.h"
58#include "kglobal.h" 58#include "kglobal.h"
59#include "ktoolbar.h" 59#include "ktoolbar.h"
60#include "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "externalapphandler.h" 62#include "externalapphandler.h"
63#include <kglobalsettings.h> 63#include <kglobalsettings.h>
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
70#include "koimportoldialog.h" 70#include "koimportoldialog.h"
71#endif 71#endif
72#endif 72#endif
73#include "mainwindow.h" 73#include "mainwindow.h"
74 74
75 75
76class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
77{ 77{
78 public: 78 public:
79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
80 QDialog( parent, name, true ) 80 QDialog( parent, name, true )
81 { 81 {
82 setCaption( i18n("Export to phone options") ); 82 setCaption( i18n("Export to phone options") );
83 QVBoxLayout* lay = new QVBoxLayout( this ); 83 QVBoxLayout* lay = new QVBoxLayout( this );
84 lay->setSpacing( 3 ); 84 lay->setSpacing( 3 );
85 lay->setMargin( 3 ); 85 lay->setMargin( 3 );
86 QLabel *lab; 86 QLabel *lab;
87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
88 lab->setAlignment (AlignHCenter ); 88 lab->setAlignment (AlignHCenter );
89 QHBox* temphb; 89 QHBox* temphb;
90 temphb = new QHBox( this ); 90 temphb = new QHBox( this );
91 new QLabel( i18n("I/O device: "), temphb ); 91 new QLabel( i18n("I/O device: "), temphb );
92 mPhoneDevice = new QLineEdit( temphb); 92 mPhoneDevice = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 93 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 94 temphb = new QHBox( this );
95 new QLabel( i18n("Connection: "), temphb ); 95 new QLabel( i18n("Connection: "), temphb );
96 mPhoneConnection = new QLineEdit( temphb); 96 mPhoneConnection = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 97 lay->addWidget( temphb );
98 temphb = new QHBox( this ); 98 temphb = new QHBox( this );
99 new QLabel( i18n("Model(opt.): "), temphb ); 99 new QLabel( i18n("Model(opt.): "), temphb );
100 mPhoneModel = new QLineEdit( temphb); 100 mPhoneModel = new QLineEdit( temphb);
101 lay->addWidget( temphb ); 101 lay->addWidget( temphb );
102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
103 mWriteBackFuture->setChecked( true ); 103 mWriteBackFuture->setChecked( true );
104 lay->addWidget( mWriteBackFuture ); 104 lay->addWidget( mWriteBackFuture );
105 temphb = new QHBox( this ); 105 temphb = new QHBox( this );
106 new QLabel( i18n("Max. weeks in future: ") , temphb ); 106 new QLabel( i18n("Max. weeks in future: ") , temphb );
107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
108 mWriteBackFutureWeeks->setValue( 8 ); 108 mWriteBackFutureWeeks->setValue( 8 );
109 lay->addWidget( temphb ); 109 lay->addWidget( temphb );
110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
111 lab->setAlignment (AlignHCenter ); 111 lab->setAlignment (AlignHCenter );
112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
113 lay->addWidget( ok ); 113 lay->addWidget( ok );
114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
115 lay->addWidget( cancel ); 115 lay->addWidget( cancel );
116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
118 resize( 220, 240 ); 118 resize( 220, 240 );
119 qApp->processEvents(); 119 qApp->processEvents();
120 int dw = QApplication::desktop()->width(); 120 int dw = QApplication::desktop()->width();
121 int dh = QApplication::desktop()->height(); 121 int dh = QApplication::desktop()->height();
122 move( (dw-width())/2, (dh - height() )/2 ); 122 move( (dw-width())/2, (dh - height() )/2 );
123 } 123 }
124 124
125public: 125public:
126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
127 QCheckBox* mWriteBackFuture; 127 QCheckBox* mWriteBackFuture;
128 QSpinBox* mWriteBackFutureWeeks; 128 QSpinBox* mWriteBackFutureWeeks;
129}; 129};
130 130
131QPixmap* sgListViewCompletedPix[6]; 131QPixmap* sgListViewCompletedPix[6];
132QPixmap* sgListViewJournalPix; 132QPixmap* sgListViewJournalPix;
133 133
134 134
135int globalFlagBlockStartup; 135int globalFlagBlockStartup;
136MainWindow::MainWindow( QWidget *parent, const char *name ) : 136MainWindow::MainWindow( QWidget *parent, const char *name ) :
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 //int size = 12; 145 //int size = 12;
146 { 146 {
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 p.drawLine ( 2, 5, 4 , 7 ) ; 151 p.drawLine ( 2, 5, 4 , 7 ) ;
152 p.drawLine ( 4 , 7 , 8, 3) ; 152 p.drawLine ( 4 , 7 , 8, 3) ;
153 int iii = 0; 153 int iii = 0;
154 for ( iii = 0; iii < 5; ++iii ) { 154 for ( iii = 0; iii < 5; ++iii ) {
155 sgListViewCompletedPix[iii]->resize( 11, 11 ); 155 sgListViewCompletedPix[iii]->resize( 11, 11 );
156 sgListViewCompletedPix[iii]->fill( Qt::white ); 156 sgListViewCompletedPix[iii]->fill( Qt::white );
157 QPainter p ( sgListViewCompletedPix[iii] ); 157 QPainter p ( sgListViewCompletedPix[iii] );
158 p.drawRect( 0,0,11,11); 158 p.drawRect( 0,0,11,11);
159 if ( iii ) 159 if ( iii )
160 p.fillRect( 1,1,iii*2,9,Qt::gray ); 160 p.fillRect( 1,1,iii*2,9,Qt::gray );
161 } 161 }
162 sgListViewJournalPix = &journalPix; 162 sgListViewJournalPix = &journalPix;
163 sgListViewJournalPix->resize( 11, 11 ); 163 sgListViewJournalPix->resize( 11, 11 );
164 sgListViewJournalPix->fill( Qt::white ); 164 sgListViewJournalPix->fill( Qt::white );
165 { 165 {
166 QPainter p ( sgListViewJournalPix ); 166 QPainter p ( sgListViewJournalPix );
167 p.drawRect( 0,0,11,11); 167 p.drawRect( 0,0,11,11);
168 p.drawLine( 2,3,5,3); 168 p.drawLine( 2,3,5,3);
169 p.drawLine( 2,5,8,5); 169 p.drawLine( 2,5,8,5);
170 p.drawLine( 2,7,6,7); 170 p.drawLine( 2,7,6,7);
171 } 171 }
172 } 172 }
173 mClosed = false; 173 mClosed = false;
174 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 174 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
175 QString confFile = locateLocal("config","korganizerrc"); 175 QString confFile = locateLocal("config","korganizerrc");
176 QFileInfo finf ( confFile ); 176 QFileInfo finf ( confFile );
177 bool showWarning = !finf.exists(); 177 bool showWarning = !finf.exists();
178 setIcon(SmallIcon( "ko24" ) ); 178 setIcon(SmallIcon( "ko24" ) );
179 mBlockAtStartup = true; 179 mBlockAtStartup = true;
180 mFlagKeyPressed = false; 180 mFlagKeyPressed = false;
181 setCaption("KO/Pi"); 181 setCaption("KO/Pi");
182 KOPrefs *p = KOPrefs::instance(); 182 KOPrefs *p = KOPrefs::instance();
183 //KPimGlobalPrefs::instance()->setGlobalConfig(); 183 //KPimGlobalPrefs::instance()->setGlobalConfig();
184 p->mCurrentDisplayedView = 0; 184 p->mCurrentDisplayedView = 0;
185 if ( p->mHourSize > 22 ) 185 if ( p->mHourSize > 22 )
186 p->mHourSize = 22; 186 p->mHourSize = 22;
187 QMainWindow::ToolBarDock tbd; 187 QMainWindow::ToolBarDock tbd;
188 if ( p->mToolBarHor ) { 188 if ( p->mToolBarHor ) {
189 if ( p->mToolBarUp ) 189 if ( p->mToolBarUp )
190 tbd = Bottom; 190 tbd = Bottom;
191 else 191 else
192 tbd = Top; 192 tbd = Top;
193 } 193 }
194 else { 194 else {
195 if ( p->mToolBarUp ) 195 if ( p->mToolBarUp )
196 tbd = Right; 196 tbd = Right;
197 else 197 else
198 tbd = Left; 198 tbd = Left;
199 } 199 }
200 if ( KOPrefs::instance()->mUseAppColors ) 200 if ( KOPrefs::instance()->mUseAppColors )
201 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 201 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
202 globalFlagBlockStartup = 1; 202 globalFlagBlockStartup = 1;
203 iconToolBar = new QPEToolBar( this ); 203 iconToolBar = new QPEToolBar( this );
204 addToolBar (iconToolBar , tbd ); 204 addToolBar (iconToolBar , tbd );
205 205
206#ifdef DESKTOP_VERSION 206#ifdef DESKTOP_VERSION
207 if ( KOPrefs::instance()->mShowIconFilter ) 207 if ( KOPrefs::instance()->mShowIconFilter )
208#else 208#else
209 if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) ) 209 if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) )
210#endif 210#endif
211 211
212{ 212{
213 if ( p->mToolBarHorF ) { 213 if ( p->mToolBarHorF ) {
214 if ( p->mToolBarUpF ) 214 if ( p->mToolBarUpF )
215 tbd = Bottom; 215 tbd = Bottom;
216 else 216 else
217 tbd = Top; 217 tbd = Top;
218 } 218 }
219 else { 219 else {
220 if ( p->mToolBarUpF ) 220 if ( p->mToolBarUpF )
221 tbd = Right; 221 tbd = Right;
222 else 222 else
223 tbd = Left; 223 tbd = Left;
224 } 224 }
225 filterToolBar = new QPEToolBar ( this ); 225 filterToolBar = new QPEToolBar ( this );
226 filterMenubar = new KMenuBar( 0 ); 226 filterMenubar = new KMenuBar( 0 );
227 QFontMetrics fm ( filterMenubar->font() ); 227 QFontMetrics fm ( filterMenubar->font() );
228#ifndef DESKTOP_VERSION 228#ifndef DESKTOP_VERSION
229 filterToolBar->setFocusPolicy( NoFocus ); 229 filterToolBar->setFocusPolicy( NoFocus );
230 filterMenubar->setFocusPolicy( NoFocus ); 230 filterMenubar->setFocusPolicy( NoFocus );
231#endif 231#endif
232 filterPopupMenu = new QPopupMenu( this ); 232 filterPopupMenu = new QPopupMenu( this );
233 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 233 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
234 QString addTest = "A"; 234 QString addTest = "A";
235 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 235 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
236#ifdef DESKTOP_VERSION 236#ifdef DESKTOP_VERSION
237 addTest = "AAAAAABBBCCCx"; 237 addTest = "AAAAAABBBCCCx";
238#else 238#else
239 addTest = "AAAAAx"; 239 addTest = "AAAAAx";
240#endif 240#endif
241 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 241 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
242 addToolBar (filterToolBar , tbd ); 242 addToolBar (filterToolBar , tbd );
243 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 243 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
244 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 244 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
245 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 245 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
246 filterToolBar->hide(); 246 filterToolBar->hide();
247 } else { 247 } else {
248 filterToolBar = 0; 248 filterToolBar = 0;
249 filterMenubar = 0; 249 filterMenubar = 0;
250 filterPopupMenu = 0; 250 filterPopupMenu = 0;
251 } 251 }
252 if ( p->mShowIconOnetoolbar ) { 252 if ( p->mShowIconOnetoolbar ) {
253 viewToolBar = iconToolBar ; 253 viewToolBar = iconToolBar ;
254 navigatorToolBar = iconToolBar ; 254 navigatorToolBar = iconToolBar ;
255 } else { 255 } else {
256#ifndef DESKTOP_VERSION 256#ifndef DESKTOP_VERSION
257 setToolBarsMovable( false ); 257 setToolBarsMovable( false );
258#endif 258#endif
259 if ( p->mToolBarHorV ) { 259 if ( p->mToolBarHorV ) {
260 if ( p->mToolBarUpV ) 260 if ( p->mToolBarUpV )
261 tbd = Bottom; 261 tbd = Bottom;
262 else 262 else
263 tbd = Top; 263 tbd = Top;
264 } 264 }
265 else { 265 else {
266 if ( p->mToolBarUpV ) 266 if ( p->mToolBarUpV )
267 tbd = Right; 267 tbd = Right;
268 else 268 else
269 tbd = Left; 269 tbd = Left;
270 } 270 }
271 viewToolBar = new QPEToolBar( this ); 271 viewToolBar = new QPEToolBar( this );
272 addToolBar (viewToolBar , tbd ); 272 addToolBar (viewToolBar , tbd );
273 if ( p->mToolBarHorN ) { 273 if ( p->mToolBarHorN ) {
274 if ( p->mToolBarUpN ) 274 if ( p->mToolBarUpN )
275 tbd = Bottom; 275 tbd = Bottom;
276 else 276 else
277 tbd = Top; 277 tbd = Top;
278 } 278 }
279 else { 279 else {
280 if ( p->mToolBarUpN ) 280 if ( p->mToolBarUpN )
281 tbd = Right; 281 tbd = Right;
282 else 282 else
283 tbd = Left; 283 tbd = Left;
284 } 284 }
285 navigatorToolBar = new QPEToolBar( this ); 285 navigatorToolBar = new QPEToolBar( this );
286 addToolBar (navigatorToolBar , tbd ); 286 addToolBar (navigatorToolBar , tbd );
287 } 287 }
288 288
289 289
290 290
291 mCalendarModifiedFlag = false; 291 mCalendarModifiedFlag = false;
292 // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 292 // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
293 //splash->setAlignment ( AlignCenter ); 293 //splash->setAlignment ( AlignCenter );
294 //setCentralWidget( splash ); 294 //setCentralWidget( splash );
295#ifndef DESKTOP_VERSION 295#ifndef DESKTOP_VERSION
296 //showMaximized(); 296 //showMaximized();
297#endif 297#endif
298 298
299 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 299 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
300 setDefaultPreferences(); 300 setDefaultPreferences();
301 mCalendar = new CalendarLocal(); 301 mCalendar = new CalendarLocal();
302 mView = new CalendarView( mCalendar, this,"mCalendar " ); 302 mView = new CalendarView( mCalendar, this,"mCalendar " );
303 setCentralWidget( mView ); 303 setCentralWidget( mView );
304 //mView->hide(); 304 //mView->hide();
305 //mView->resize(splash->size() ); 305 //mView->resize(splash->size() );
306 initActions(); 306 initActions();
307 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 307 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
308 mSyncManager->setBlockSave(false); 308 mSyncManager->setBlockSave(false);
309 mView->setSyncManager(mSyncManager); 309 mView->setSyncManager(mSyncManager);
310#ifndef DESKTOP_VERSION 310#ifndef DESKTOP_VERSION
311 //iconToolBar->show(); 311 //iconToolBar->show();
312 //qApp->processEvents(); 312 //qApp->processEvents();
313#endif 313#endif
314 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 314 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
315 int vh = height() ; 315 int vh = height() ;
316 int vw = width(); 316 int vw = width();
317 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 317 //qDebug("Toolbar hei %d ",iconToolBar->height() );
318 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 318 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
319 vh -= iconToolBar->height(); 319 vh -= iconToolBar->height();
320 } else { 320 } else {
321 vw -= iconToolBar->height(); 321 vw -= iconToolBar->height();
322 } 322 }
323 //mView->setMaximumSize( splash->size() ); 323 //mView->setMaximumSize( splash->size() );
324 //mView->resize( splash->size() ); 324 //mView->resize( splash->size() );
325 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 325 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
326 mView->readSettings(); 326 mView->readSettings();
327 bool newFile = false; 327 bool newFile = false;
328 if( !QFile::exists( defaultFileName() ) ) { 328 if( !QFile::exists( defaultFileName() ) ) {
329 QFileInfo finfo ( defaultFileName() ); 329 QFileInfo finfo ( defaultFileName() );
330 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 330 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
331 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"; 331 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";
332 finfo.setFile( oldFile ); 332 finfo.setFile( oldFile );
333 if (finfo.exists() ) { 333 if (finfo.exists() ) {
334 KMessageBox::information( this, message); 334 KMessageBox::information( this, message);
335 mView->openCalendar( oldFile ); 335 mView->openCalendar( oldFile );
336 qApp->processEvents(); 336 qApp->processEvents();
337 } else { 337 } else {
338 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 338 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
339 finfo.setFile( oldFile ); 339 finfo.setFile( oldFile );
340 if (finfo.exists() ) { 340 if (finfo.exists() ) {
341 KMessageBox::information( this, message); 341 KMessageBox::information( this, message);
342 mView->openCalendar( oldFile ); 342 mView->openCalendar( oldFile );
343 qApp->processEvents(); 343 qApp->processEvents();
344 } 344 }
345 } 345 }
346 mView->saveCalendar( defaultFileName() ); 346 mView->saveCalendar( defaultFileName() );
347 newFile = true; 347 newFile = true;
348 } 348 }
349 349
350 //QTime neededSaveTime = QDateTime::currentDateTime().time(); 350 //QTime neededSaveTime = QDateTime::currentDateTime().time();
351 //mView->loadCalendars(); 351 //mView->loadCalendars();
352 //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 352 //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
353 //qDebug("KO: Calendar loading time: %d ms",msNeeded ); 353 //qDebug("KO: Calendar loading time: %d ms",msNeeded );
354 354
355 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 355 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
356 KOPrefs::instance()->setAllDefaults(); 356 KOPrefs::instance()->setAllDefaults();
357 } 357 }
358 358
359 359
360 connect( mView, SIGNAL( tempDisableBR(bool) ), 360 connect( mView, SIGNAL( tempDisableBR(bool) ),
361 SLOT( disableBR(bool) ) ); 361 SLOT( disableBR(bool) ) );
362 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 362 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
363 setCentralWidget( mView ); 363 setCentralWidget( mView );
364 globalFlagBlockStartup = 0; 364 globalFlagBlockStartup = 0;
365 //mView->show(); 365 //mView->show();
366 //delete splash; 366 //delete splash;
367 if ( newFile ) 367 if ( newFile )
368 mView->updateConfig(); 368 mView->updateConfig();
369 // qApp->processEvents(); 369 // qApp->processEvents();
370 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 370 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
371 //fillSyncMenu(); 371 //fillSyncMenu();
372 372
373 373
374 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 374 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
375 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 375 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
376 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 376 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
377 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 377 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
378 mSyncManager->setDefaultFileName( sentSyncFile()); 378 mSyncManager->setDefaultFileName( sentSyncFile());
379 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 379 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
380 mSyncManager->fillSyncMenu(); 380 mSyncManager->fillSyncMenu();
381 381
382 382
383 383
384 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 384 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
385 if ( showWarning ) { 385 if ( showWarning ) {
386 KMessageBox::information( this, 386 KMessageBox::information( this,
387 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 387 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
388 //qApp->processEvents(); 388 //qApp->processEvents();
389 mView->dialogManager()->showSyncOptions(); 389 mView->dialogManager()->showSyncOptions();
390 } 390 }
391 391
392 //US listen for result adressed from Ka/Pi 392 //US listen for result adressed from Ka/Pi
393 393
394#ifndef DESKTOP_VERSION 394#ifndef DESKTOP_VERSION
395 infrared = 0; 395 infrared = 0;
396#endif 396#endif
397 updateFilterToolbar(); 397 updateFilterToolbar();
398 updateWeek( mView->startDate() ); 398 updateWeek( mView->startDate() );
399 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 399 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
400 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 400 SLOT( updateWeekNum( const KCal::DateList & ) ) );
401 mBRdisabled = false; 401 mBRdisabled = false;
402 //toggleBeamReceive(); 402 //toggleBeamReceive();
403 403
404 setCaption(i18n("Loading calendar files ... please wait" )); 404 setCaption(i18n("Loading calendar files ... please wait" ));
405 mSaveDelay = 0; 405 mSaveDelay = 0;
406 QTimer::singleShot( 1, this, SLOT ( loadDataAfterStart() )); 406 QTimer::singleShot( 1, this, SLOT ( loadDataAfterStart() ));
407} 407}
408MainWindow::~MainWindow() 408MainWindow::~MainWindow()
409{ 409{
410 //qDebug("MainWindow::~MainWindow() "); 410 //qDebug("MainWindow::~MainWindow() ");
411 //save toolbar location 411 //save toolbar location
412 delete mCalendar; 412 delete mCalendar;
413 delete mSyncManager; 413 delete mSyncManager;
414#ifndef DESKTOP_VERSION 414#ifndef DESKTOP_VERSION
415 if ( infrared ) 415 if ( infrared )
416 delete infrared; 416 delete infrared;
417#endif 417#endif
418 418
419 419
420} 420}
421 421
422void MainWindow::loadDataAfterStart() 422void MainWindow::loadDataAfterStart()
423{ 423{
424
425 qDebug("KO: Start loading files..." ); 424 qDebug("KO: Start loading files..." );
426 QTime neededSaveTime = QDateTime::currentDateTime().time(); 425 QTime neededSaveTime = QDateTime::currentDateTime().time();
427 mView->loadCalendars(); 426 mView->loadCalendars();
428 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 427 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
429 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 428 qDebug("KO: Calendar loading time: %d ms",msNeeded );
430 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 429 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
431 mView->setModified( false ); 430 mView->setModified( false );
432 mBlockAtStartup = false; 431 mBlockAtStartup = false;
433 mView->setModified( false ); 432 mView->setModified( false );
434 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 433 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
435 processIncidenceSelection( 0 ); 434 processIncidenceSelection( 0 );
436 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 435 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
437 SLOT( processIncidenceSelection( Incidence * ) ) ); 436 SLOT( processIncidenceSelection( Incidence * ) ) );
438 connect( mView, SIGNAL( modifiedChanged( bool ) ), 437 connect( mView, SIGNAL( modifiedChanged( bool ) ),
439 SLOT( slotModifiedChanged( bool ) ) ); 438 SLOT( slotModifiedChanged( bool ) ) );
440
441#ifndef DESKTOP_VERSION 439#ifndef DESKTOP_VERSION
442 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 440 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
443 connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); 441 connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& )));
444 disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); 442 disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& )));
445 ((QPEApplication*) qApp)->showMainWidget( this );
446 if ( !mCStringMess.isEmpty() ) 443 if ( !mCStringMess.isEmpty() )
447 recieve( mCStringMess, mByteData ); 444 recieve( mCStringMess, mByteData );
448#endif 445#endif
449 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 446 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
450} 447}
451 448
452void MainWindow::slotResetFocus() 449void MainWindow::slotResetFocus()
453{ 450{
454 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); 451 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar);
455 mFocusLoop = 3; 452 mFocusLoop = 3;
456 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 453 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
457} 454}
458void MainWindow::slotResetFocusLoop() 455void MainWindow::slotResetFocusLoop()
459{ 456{
460 --mFocusLoop; 457 --mFocusLoop;
461 QWidget* fw = mView->viewManager()->currentView(); 458 QWidget* fw = mView->viewManager()->currentView();
462 if ( fw ) { 459 if ( fw ) {
463 //qDebug("loop "); 460 //qDebug("loop ");
464 fw->setFocus(); 461 fw->setFocus();
465 if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) 462 if ( qApp->focusWidget() != fw && mFocusLoop > 0 )
466 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 463 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
467 } 464 }
468 465
469} 466}
470void MainWindow::disableBR(bool b) 467void MainWindow::disableBR(bool b)
471{ 468{
472#ifndef DESKTOP_VERSION 469#ifndef DESKTOP_VERSION
473 if ( b ) { 470 if ( b ) {
474 if ( infrared ) { 471 if ( infrared ) {
475 toggleBeamReceive(); 472 toggleBeamReceive();
476 mBRdisabled = true; 473 mBRdisabled = true;
477 } 474 }
478 mBRdisabled = true; 475 mBRdisabled = true;
479 } else { 476 } else {
480 if ( mBRdisabled ) { 477 if ( mBRdisabled ) {
481 mBRdisabled = false; 478 mBRdisabled = false;
482 //makes no sense,because other cal ap is probably running 479 //makes no sense,because other cal ap is probably running
483 // toggleBeamReceive(); 480 // toggleBeamReceive();
484 } 481 }
485 } 482 }
486#endif 483#endif
487 484
488} 485}
489bool MainWindow::beamReceiveEnabled() 486bool MainWindow::beamReceiveEnabled()
490{ 487{
491#ifndef DESKTOP_VERSION 488#ifndef DESKTOP_VERSION
492 return ( infrared != 0 ); 489 return ( infrared != 0 );
493#endif 490#endif
494 return false; 491 return false;
495} 492}
496 493
497void MainWindow::toggleBeamReceive() 494void MainWindow::toggleBeamReceive()
498{ 495{
499 if ( mBRdisabled ) 496 if ( mBRdisabled )
500 return; 497 return;
501#ifndef DESKTOP_VERSION 498#ifndef DESKTOP_VERSION
502 if ( infrared ) { 499 if ( infrared ) {
503 qDebug("KO: Disable BeamReceive "); 500 qDebug("KO: Disable BeamReceive ");
504 delete infrared; 501 delete infrared;
505 infrared = 0; 502 infrared = 0;
506 brAction->setOn(false); 503 brAction->setOn(false);
507 return; 504 return;
508 } 505 }
509 qDebug("KO: Enable BeamReceive "); 506 qDebug("KO: Enable BeamReceive ");
510 brAction->setOn(true); 507 brAction->setOn(true);
511 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 508 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
512 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 509 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
513#endif 510#endif
514} 511}
515void MainWindow::showMaximized () 512void MainWindow::showMaximized ()
516{ 513{
517#ifndef DESKTOP_VERSION 514#ifndef DESKTOP_VERSION
518 if ( ! globalFlagBlockStartup ) 515 if ( ! globalFlagBlockStartup )
519 if ( mClosed ) 516 if ( mClosed )
520 mView->goToday(); 517 mView->goToday();
521#endif 518#endif
522 QWidget::showMaximized () ; 519 QWidget::showMaximized () ;
523 mClosed = false; 520 mClosed = false;
524} 521}
525 522
526bool MainWindow::askForQuitOnSaveError() 523bool MainWindow::askForQuitOnSaveError()
527{ 524{
528 bool retval = false; 525 bool retval = false;
529 switch( QMessageBox::information( this, "KO/Pi", 526 switch( QMessageBox::information( this, "KO/Pi",
530 i18n("Error saving data") + "!\n" + 527 i18n("Error saving data") + "!\n" +
531 i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" + 528 i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" +
532 i18n("Do you really want\nto close KO/Pi?"), 529 i18n("Do you really want\nto close KO/Pi?"),
533 i18n(" Yes, close "), i18n("No"), 530 i18n(" Yes, close "), i18n("No"),
534 0, 1 ) ) { 531 0, 1 ) ) {
535 case 0: 532 case 0:
536 retval = true; 533 retval = true;
537 break; 534 break;
538 default: 535 default:
539 break; 536 break;
540 } 537 }
541 return retval; 538 return retval;
542} 539}
543 540
544void MainWindow::closeEvent( QCloseEvent* ce ) 541void MainWindow::closeEvent( QCloseEvent* ce )
545{ 542{
546 543
547 544
548 545
549 if ( ! KOPrefs::instance()->mAskForQuit ) { 546 if ( ! KOPrefs::instance()->mAskForQuit ) {
550 saveOnClose(); 547 saveOnClose();
551 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 548 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
552 ce->ignore(); 549 ce->ignore();
553 return; 550 return;
554 } 551 }
555 mClosed = true; 552 mClosed = true;
556 ce->accept(); 553 ce->accept();
557 return; 554 return;
558 555
559 } 556 }
560 557
561 switch( QMessageBox::information( this, "KO/Pi", 558 switch( QMessageBox::information( this, "KO/Pi",
562 i18n("Do you really want\nto close KO/Pi?"), 559 i18n("Do you really want\nto close KO/Pi?"),
563 i18n("Close"), i18n("No"), 560 i18n("Close"), i18n("No"),
564 0, 0 ) ) { 561 0, 0 ) ) {
565 case 0: 562 case 0:
566 saveOnClose(); 563 saveOnClose();
567 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 564 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
568 ce->ignore(); 565 ce->ignore();
569 return; 566 return;
570 } 567 }
571 mClosed = true; 568 mClosed = true;
572 ce->accept(); 569 ce->accept();
573 break; 570 break;
574 case 1: 571 case 1:
575 ce->ignore(); 572 ce->ignore();
576 break; 573 break;
577 case 2: 574 case 2:
578 575
579 default: 576 default:
580 break; 577 break;
581 } 578 }
582 579
583 580
584} 581}
585void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) 582void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data )
586{ 583{
587 qDebug("KO: QCOP start message received: %s ", cmsg.data() ); 584 qDebug("KO: QCOP start message received: %s ", cmsg.data() );
588 mCStringMess = cmsg; 585 mCStringMess = cmsg;
589 mByteData = data; 586 mByteData = data;
590} 587}
591void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 588void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
592{ 589{
593 QDataStream stream( data, IO_ReadOnly ); 590 QDataStream stream( data, IO_ReadOnly );
594 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 591 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
595 //QString datamess; 592 //QString datamess;
596 //qDebug("message "); 593 //qDebug("message ");
597 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 594 qDebug("KO: QCOP message received: %s ", cmsg.data() );
598 595
599 if ( cmsg == "setDocument(QString)" ) { 596 if ( cmsg == "setDocument(QString)" ) {
600 QDataStream stream( data, IO_ReadOnly ); 597 QDataStream stream( data, IO_ReadOnly );
601 QString fileName; 598 QString fileName;
602 stream >> fileName; 599 stream >> fileName;
603 //qDebug("filename %s ", fileName.latin1()); 600 //qDebug("filename %s ", fileName.latin1());
604 showMaximized(); 601 showMaximized();
605 raise(); 602 raise();
606 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 603 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
607 mSyncManager->slotSyncMenu( 1002 ); 604 mSyncManager->slotSyncMenu( 1002 );
608 return; 605 return;
609 } 606 }
610 607
611 if ( cmsg == "-writeFile" ) { 608 if ( cmsg == "-writeFile" ) {
612 // I made from the "-writeFile" an "-writeAlarm" 609 // I made from the "-writeFile" an "-writeAlarm"
613 mView->viewManager()->showWhatsNextView(); 610 mView->viewManager()->showWhatsNextView();
614 mCalendar->checkAlarmForIncidence( 0, true); 611 mCalendar->checkAlarmForIncidence( 0, true);
615 showMaximized(); 612 showMaximized();
616 raise(); 613 raise();
617 return; 614 return;
618 615
619 } 616 }
620 if ( cmsg == "-writeFileSilent" ) { 617 if ( cmsg == "-writeFileSilent" ) {
621 // I made from the "-writeFile" an "-writeAlarm" 618 // I made from the "-writeFile" an "-writeAlarm"
622 // mView->viewManager()->showWhatsNextView(); 619 // mView->viewManager()->showWhatsNextView();
623 mCalendar->checkAlarmForIncidence( 0, true); 620 mCalendar->checkAlarmForIncidence( 0, true);
624 //showMaximized(); 621 //showMaximized();
625 //raise(); 622 //raise();
626 hide(); 623 hide();
627 return; 624 return;
628 } 625 }
629 if ( cmsg == "-newCountdown" ) { 626 if ( cmsg == "-newCountdown" ) {
630 qDebug("newCountdown "); 627 qDebug("newCountdown ");
631 628
632 } 629 }
633 QString msg ; 630 QString msg ;
634 QString allmsg = cmsg; 631 QString allmsg = cmsg;
635 while ( allmsg.length() > 0 ) { 632 while ( allmsg.length() > 0 ) {
636 int nextC = allmsg.find( "-", 1 ); 633 int nextC = allmsg.find( "-", 1 );
637 if ( nextC == -1 ) { 634 if ( nextC == -1 ) {
638 msg = allmsg; 635 msg = allmsg;
639 allmsg = ""; 636 allmsg = "";
640 } else{ 637 } else{
641 msg = allmsg.left( nextC ); 638 msg = allmsg.left( nextC );
642 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 639 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
643 } 640 }
644 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 641 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
645 if ( msg == "-newEvent" ) { 642 if ( msg == "-newEvent" ) {
646 QTimer::singleShot( 0, mView, SLOT ( newEvent())); 643 QTimer::singleShot( 0, mView, SLOT ( newEvent()));
647 } 644 }
648 if ( msg == "-newTodo" ) { 645 if ( msg == "-newTodo" ) {
649 QTimer::singleShot( 0, mView, SLOT ( newTodo())); 646 QTimer::singleShot( 0, mView, SLOT ( newTodo()));
650 } 647 }
651 if ( msg == "-showWN" ) { 648 if ( msg == "-showWN" ) {
652 mView->viewManager()->showWhatsNextView(); 649 mView->viewManager()->showWhatsNextView();
653 } 650 }
654 if ( msg == "-showTodo" ) { 651 if ( msg == "-showTodo" ) {
655 mView->viewManager()->showTodoView(); 652 mView->viewManager()->showTodoView();
656 } 653 }
657 if ( msg == "-showList" ) { 654 if ( msg == "-showList" ) {
658 mView->viewManager()->showListView(); 655 mView->viewManager()->showListView();
659 } 656 }
660 else if ( msg == "-showDay" ) { 657 else if ( msg == "-showDay" ) {
661 mView->viewManager()->showDayView(); 658 mView->viewManager()->showDayView();
662 } 659 }
663 else if ( msg == "-showWWeek" ) { 660 else if ( msg == "-showWWeek" ) {
664 mView->viewManager()->showWorkWeekView(); 661 mView->viewManager()->showWorkWeekView();
665 } 662 }
666 else if ( msg == "-ringSync" ) { 663 else if ( msg == "-ringSync" ) {
667 QTimer::singleShot( 0, this, SLOT (startMultiSync())); 664 QTimer::singleShot( 0, this, SLOT (startMultiSync()));
668 } 665 }
669 else if ( msg == "-showWeek" ) { 666 else if ( msg == "-showWeek" ) {
670 mView->viewManager()->showWeekView(); 667 mView->viewManager()->showWeekView();
671 } 668 }
672 else if ( msg == "-showTodo" ) { 669 else if ( msg == "-showTodo" ) {
673 mView->viewManager()->showTodoView(); 670 mView->viewManager()->showTodoView();
674 } 671 }
675 else if ( msg == "-showJournal" ) { 672 else if ( msg == "-showJournal" ) {
676 mView->dateNavigator()->selectDates( 1 ); 673 mView->dateNavigator()->selectDates( 1 );
677 mView->dateNavigator()->selectToday(); 674 mView->dateNavigator()->selectToday();
678 mView->viewManager()->showJournalView(); 675 mView->viewManager()->showJournalView();
679 } 676 }
680 else if ( msg == "-showKO" ) { 677 else if ( msg == "-showKO" ) {
681 mView->viewManager()->showNextXView(); 678 mView->viewManager()->showNextXView();
682 } 679 }
683 else if ( msg == "-showWNext" ) { 680 else if ( msg == "-showWNext" ) {
684 mView->viewManager()->showWhatsNextView(); 681 mView->viewManager()->showWhatsNextView();
685 } 682 }
686 else if ( msg == "nextView()" ) { 683 else if ( msg == "nextView()" ) {
687 mView->viewManager()->showNextView(); 684 mView->viewManager()->showNextView();
688 } 685 }
689 else if ( msg == "-showNextXView" ) { 686 else if ( msg == "-showNextXView" ) {
690 mView->viewManager()->showNextXView(); 687 mView->viewManager()->showNextXView();
691 } 688 }
692 689
693 690
694 } 691 }
695 692
696 showMaximized(); 693 showMaximized();
697 raise(); 694 raise();
698} 695}
699void MainWindow::startMultiSync() 696void MainWindow::startMultiSync()
700{ 697{
701 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 698 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
702 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), 699 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
703 question, 700 question,
704 i18n("Yes"), i18n("No"), 701 i18n("Yes"), i18n("No"),
705 0, 0 ) != 0 ) { 702 0, 0 ) != 0 ) {
706 setCaption(i18n("Aborted! Nothing synced!")); 703 setCaption(i18n("Aborted! Nothing synced!"));
707 return; 704 return;
708 } 705 }
709 mSyncManager->multiSync( false ); 706 mSyncManager->multiSync( false );
710#ifndef DESKTOP_VERSION 707#ifndef DESKTOP_VERSION
711 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 708 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
712#endif 709#endif
713} 710}
714QPixmap MainWindow::loadPixmap( QString name ) 711QPixmap MainWindow::loadPixmap( QString name )
715{ 712{
716 return SmallIcon( name ); 713 return SmallIcon( name );
717 714
718} 715}
719void MainWindow::setUsesBigPixmaps ( bool b ) 716void MainWindow::setUsesBigPixmaps ( bool b )
720{ 717{
721 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 718 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
722 if ( b ) 719 if ( b )
723 qDebug("KO: BigPixmaps are not supported "); 720 qDebug("KO: BigPixmaps are not supported ");
724} 721}
725void MainWindow::initActions() 722void MainWindow::initActions()
726{ 723{
727 //KOPrefs::instance()->mShowFullMenu 724 //KOPrefs::instance()->mShowFullMenu
728 iconToolBar->clear(); 725 iconToolBar->clear();
729 KOPrefs *p = KOPrefs::instance(); 726 KOPrefs *p = KOPrefs::instance();
730 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 727 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
731 728
732 QPopupMenu *viewMenu = new QPopupMenu( this ); 729 QPopupMenu *viewMenu = new QPopupMenu( this );
733 QPopupMenu *actionMenu = new QPopupMenu( this ); 730 QPopupMenu *actionMenu = new QPopupMenu( this );
734 mCurrentItemMenu = new QPopupMenu ( this ); 731 mCurrentItemMenu = new QPopupMenu ( this );
735 QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); 732 QPopupMenu *nextConflictMenu = new QPopupMenu ( this );
736 QPopupMenu *importMenu = new QPopupMenu( this ); 733 QPopupMenu *importMenu = new QPopupMenu( this );
737 QPopupMenu *importMenu_X = new QPopupMenu( this ); 734 QPopupMenu *importMenu_X = new QPopupMenu( this );
738 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 735 QPopupMenu *exportMenu_X = new QPopupMenu( this );
739 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 736 QPopupMenu *beamMenu_X = new QPopupMenu( this );
740 selectFilterMenu = new QPopupMenu( this ); 737 selectFilterMenu = new QPopupMenu( this );
741 selectFilterMenu->setCheckable( true ); 738 selectFilterMenu->setCheckable( true );
742 syncMenu = new QPopupMenu( this ); 739 syncMenu = new QPopupMenu( this );
743 configureAgendaMenu = new QPopupMenu( this ); 740 configureAgendaMenu = new QPopupMenu( this );
744 configureToolBarMenu = new QPopupMenu( this ); 741 configureToolBarMenu = new QPopupMenu( this );
745 QPopupMenu *helpMenu = new QPopupMenu( this ); 742 QPopupMenu *helpMenu = new QPopupMenu( this );
746 QIconSet icon; 743 QIconSet icon;
747 int pixWid = 22, pixHei = 22; 744 int pixWid = 22, pixHei = 22;
748 QString pathString = ""; 745 QString pathString = "";
749 if ( !p->mToolBarMiniIcons ) { 746 if ( !p->mToolBarMiniIcons ) {
750 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 747 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
751 pathString += "icons16/"; 748 pathString += "icons16/";
752 pixWid = 18; pixHei = 16; 749 pixWid = 18; pixHei = 16;
753 } 750 }
754 } else { 751 } else {
755 pathString += "iconsmini/"; 752 pathString += "iconsmini/";
756 pixWid = 18; pixHei = 16; 753 pixWid = 18; pixHei = 16;
757 } 754 }
758 755
759 if ( KOPrefs::instance()->mShowFullMenu ) { 756 if ( KOPrefs::instance()->mShowFullMenu ) {
760 menuBar1 = new KMenuBar( this );//menuBar(); 757 menuBar1 = new KMenuBar( this );//menuBar();
761 //setMenuBar( menuBar1 ); 758 //setMenuBar( menuBar1 );
762 menuBar1->show(); 759 menuBar1->show();
763 menuBar1->insertItem( i18n("File"), importMenu ); 760 menuBar1->insertItem( i18n("File"), importMenu );
764 menuBar1->insertItem( i18n("View"), viewMenu ); 761 menuBar1->insertItem( i18n("View"), viewMenu );
765 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); 762 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu );
766 menuBar1->insertItem( i18n("Action"), actionMenu ); 763 menuBar1->insertItem( i18n("Action"), actionMenu );
767#ifdef DESKTOP_VERSION 764#ifdef DESKTOP_VERSION
768 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 765 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
769 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 766 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
770#else 767#else
771 menuBar1->insertItem( i18n("Sync"), syncMenu ); 768 menuBar1->insertItem( i18n("Sync"), syncMenu );
772 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 769 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
773#endif 770#endif
774 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 771 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
775 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 772 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
776 menuBar1->insertItem( i18n("Help"), helpMenu ); 773 menuBar1->insertItem( i18n("Help"), helpMenu );
777 } else { 774 } else {
778 menuBar1 = new KMenuBar( iconToolBar ); 775 menuBar1 = new KMenuBar( iconToolBar );
779 QPopupMenu *menuBar = new QPopupMenu( this ); 776 QPopupMenu *menuBar = new QPopupMenu( this );
780 icon = loadPixmap( pathString + "z_menu" ); 777 icon = loadPixmap( pathString + "z_menu" );
781 menuBar1->insertItem( icon.pixmap(), menuBar); 778 menuBar1->insertItem( icon.pixmap(), menuBar);
782 //menuBar1->insertItem( i18n("ME"), menuBar); 779 //menuBar1->insertItem( i18n("ME"), menuBar);
783 menuBar->insertItem( i18n("File"), importMenu ); 780 menuBar->insertItem( i18n("File"), importMenu );
784 menuBar->insertItem( i18n("View"), viewMenu ); 781 menuBar->insertItem( i18n("View"), viewMenu );
785 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); 782 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu );
786 menuBar->insertItem( i18n("Action"), actionMenu ); 783 menuBar->insertItem( i18n("Action"), actionMenu );
787 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 784 menuBar->insertItem( i18n("Synchronize"), syncMenu );
788 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 785 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
789 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 786 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
790 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 787 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
791 menuBar->insertItem( i18n("Help"), helpMenu ); 788 menuBar->insertItem( i18n("Help"), helpMenu );
792 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 789 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
793 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 790 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
794 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); 791 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) );
795 } 792 }
796 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 793 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
797 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 794 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
798 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 795 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
799 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 796 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
800 797
801 798
802 mWeekBgColor = iconToolBar->backgroundColor(); 799 mWeekBgColor = iconToolBar->backgroundColor();
803 mWeekPixmap.resize( pixWid , pixHei ); 800 mWeekPixmap.resize( pixWid , pixHei );
804 mWeekPixmap.fill( mWeekBgColor ); 801 mWeekPixmap.fill( mWeekBgColor );
805 icon = mWeekPixmap; 802 icon = mWeekPixmap;
806 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 803 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
807 if ( p-> mShowIconWeekNum ) 804 if ( p-> mShowIconWeekNum )
808 mWeekAction->addTo( iconToolBar ); 805 mWeekAction->addTo( iconToolBar );
809 mWeekFont = font(); 806 mWeekFont = font();
810 807
811 int fontPoint = mWeekFont.pointSize(); 808 int fontPoint = mWeekFont.pointSize();
812 QFontMetrics f( mWeekFont ); 809 QFontMetrics f( mWeekFont );
813 int fontWid = f.width( "30" ); 810 int fontWid = f.width( "30" );
814 while ( fontWid > pixWid ) { 811 while ( fontWid > pixWid ) {
815 --fontPoint; 812 --fontPoint;
816 mWeekFont.setPointSize( fontPoint ); 813 mWeekFont.setPointSize( fontPoint );
817 QFontMetrics f( mWeekFont ); 814 QFontMetrics f( mWeekFont );
818 fontWid = f.width( "30" ); 815 fontWid = f.width( "30" );
819 //qDebug("dec-- "); 816 //qDebug("dec-- ");
820 } 817 }
821 818
822 connect( mWeekAction, SIGNAL( activated() ), 819 connect( mWeekAction, SIGNAL( activated() ),
823 this, SLOT( weekAction() ) ); 820 this, SLOT( weekAction() ) );
824 821
825 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 822 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
826 if ( p->mShowIconFilterview ) { 823 if ( p->mShowIconFilterview ) {
827 icon = loadPixmap( pathString + "filter" ); 824 icon = loadPixmap( pathString + "filter" );
828 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 825 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
829 connect( actionFilterMenuTB, SIGNAL( activated() ), 826 connect( actionFilterMenuTB, SIGNAL( activated() ),