summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Unidiff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 8e5d108..95bef66 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -39,49 +39,48 @@
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 "simplealarmclient.h"
64#include "externalapphandler.h" 63#include "externalapphandler.h"
65 64
66using namespace KCal; 65using namespace KCal;
67#ifndef _WIN32_ 66#ifndef _WIN32_
68#include <unistd.h> 67#include <unistd.h>
69#else 68#else
70#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
71#include "koimportoldialog.h" 70#include "koimportoldialog.h"
72#endif 71#endif
73#endif 72#endif
74#include "mainwindow.h" 73#include "mainwindow.h"
75 74
76 75
77class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
78{ 77{
79 public: 78 public:
80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
81 QDialog( parent, name, true ) 80 QDialog( parent, name, true )
82 { 81 {
83 setCaption( i18n("Export to phone options") ); 82 setCaption( i18n("Export to phone options") );
84 QVBoxLayout* lay = new QVBoxLayout( this ); 83 QVBoxLayout* lay = new QVBoxLayout( this );
85 lay->setSpacing( 3 ); 84 lay->setSpacing( 3 );
86 lay->setMargin( 3 ); 85 lay->setMargin( 3 );
87 QLabel *lab; 86 QLabel *lab;
@@ -264,49 +263,48 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
264 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 263 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
265 mSyncManager->setBlockSave(false); 264 mSyncManager->setBlockSave(false);
266 mView->setSyncManager(mSyncManager); 265 mView->setSyncManager(mSyncManager);
267#ifndef DESKTOP_VERSION 266#ifndef DESKTOP_VERSION
268 iconToolBar->show(); 267 iconToolBar->show();
269 qApp->processEvents(); 268 qApp->processEvents();
270#endif 269#endif
271 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 270 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
272 int vh = height() ; 271 int vh = height() ;
273 int vw = width(); 272 int vw = width();
274 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 273 //qDebug("Toolbar hei %d ",iconToolBar->height() );
275 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 274 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
276 vh -= iconToolBar->height(); 275 vh -= iconToolBar->height();
277 } else { 276 } else {
278 vw -= iconToolBar->height(); 277 vw -= iconToolBar->height();
279 } 278 }
280 //mView->setMaximumSize( splash->size() ); 279 //mView->setMaximumSize( splash->size() );
281 //mView->resize( splash->size() ); 280 //mView->resize( splash->size() );
282 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 281 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
283 mView->readSettings(); 282 mView->readSettings();
284 bool newFile = false; 283 bool newFile = false;
285 if( !QFile::exists( defaultFileName() ) ) { 284 if( !QFile::exists( defaultFileName() ) ) {
286 QFileInfo finfo ( defaultFileName() ); 285 QFileInfo finfo ( defaultFileName() );
287 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 286 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
288 qDebug("oldfile %s ", oldFile.latin1());
289 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"; 287 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";
290 finfo.setFile( oldFile ); 288 finfo.setFile( oldFile );
291 if (finfo.exists() ) { 289 if (finfo.exists() ) {
292 KMessageBox::information( this, message); 290 KMessageBox::information( this, message);
293 mView->openCalendar( oldFile ); 291 mView->openCalendar( oldFile );
294 qApp->processEvents(); 292 qApp->processEvents();
295 } else { 293 } else {
296 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 294 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
297 finfo.setFile( oldFile ); 295 finfo.setFile( oldFile );
298 if (finfo.exists() ) { 296 if (finfo.exists() ) {
299 KMessageBox::information( this, message); 297 KMessageBox::information( this, message);
300 mView->openCalendar( oldFile ); 298 mView->openCalendar( oldFile );
301 qApp->processEvents(); 299 qApp->processEvents();
302 } 300 }
303 } 301 }
304 mView->saveCalendar( defaultFileName() ); 302 mView->saveCalendar( defaultFileName() );
305 newFile = true; 303 newFile = true;
306 } 304 }
307 305
308 QTime neededSaveTime = QDateTime::currentDateTime().time(); 306 QTime neededSaveTime = QDateTime::currentDateTime().time();
309 mView->openCalendar( defaultFileName() ); 307 mView->openCalendar( defaultFileName() );
310 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 308 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
311 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 309 qDebug("KO: Calendar loading time: %d ms",msNeeded );
312 310
@@ -397,55 +395,55 @@ void MainWindow::disableBR(bool b)
397 } else { 395 } else {
398 if ( mBRdisabled ) { 396 if ( mBRdisabled ) {
399 mBRdisabled = false; 397 mBRdisabled = false;
400 //makes no sense,because other cal ap is probably running 398 //makes no sense,because other cal ap is probably running
401 // toggleBeamReceive(); 399 // toggleBeamReceive();
402 } 400 }
403 } 401 }
404#endif 402#endif
405 403
406} 404}
407bool MainWindow::beamReceiveEnabled() 405bool MainWindow::beamReceiveEnabled()
408{ 406{
409#ifndef DESKTOP_VERSION 407#ifndef DESKTOP_VERSION
410 return ( infrared != 0 ); 408 return ( infrared != 0 );
411#endif 409#endif
412 return false; 410 return false;
413} 411}
414 412
415void MainWindow::toggleBeamReceive() 413void MainWindow::toggleBeamReceive()
416{ 414{
417 if ( mBRdisabled ) 415 if ( mBRdisabled )
418 return; 416 return;
419#ifndef DESKTOP_VERSION 417#ifndef DESKTOP_VERSION
420 if ( infrared ) { 418 if ( infrared ) {
421 qDebug("disable BeamReceive "); 419 qDebug("KO: Disable BeamReceive ");
422 delete infrared; 420 delete infrared;
423 infrared = 0; 421 infrared = 0;
424 brAction->setOn(false); 422 brAction->setOn(false);
425 return; 423 return;
426 } 424 }
427 qDebug("enable BeamReceive "); 425 qDebug("KO: Enable BeamReceive ");
428 brAction->setOn(true); 426 brAction->setOn(true);
429 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 427 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
430 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 428 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
431#endif 429#endif
432} 430}
433void MainWindow::showMaximized () 431void MainWindow::showMaximized ()
434{ 432{
435#ifndef DESKTOP_VERSION 433#ifndef DESKTOP_VERSION
436 if ( ! globalFlagBlockStartup ) 434 if ( ! globalFlagBlockStartup )
437 if ( mClosed ) 435 if ( mClosed )
438 mView->goToday(); 436 mView->goToday();
439#endif 437#endif
440 QWidget::showMaximized () ; 438 QWidget::showMaximized () ;
441 mClosed = false; 439 mClosed = false;
442} 440}
443void MainWindow::closeEvent( QCloseEvent* ce ) 441void MainWindow::closeEvent( QCloseEvent* ce )
444{ 442{
445 443
446 444
447 445
448 if ( ! KOPrefs::instance()->mAskForQuit ) { 446 if ( ! KOPrefs::instance()->mAskForQuit ) {
449 saveOnClose(); 447 saveOnClose();
450 mClosed = true; 448 mClosed = true;
451 ce->accept(); 449 ce->accept();