author | zautrix <zautrix> | 2005-09-19 02:49:09 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-09-19 02:49:09 (UTC) |
commit | 396aeedb3351ecf9024a3975a5bce9166f0d8aef (patch) (side-by-side diff) | |
tree | 098f2e2c14939aeeb7e84ab5ff9959c51547fbbc /korganizer | |
parent | f4b88b634935aac5a1212e86d8eb5d90c1eff301 (diff) | |
download | kdepimpi-396aeedb3351ecf9024a3975a5bce9166f0d8aef.zip kdepimpi-396aeedb3351ecf9024a3975a5bce9166f0d8aef.tar.gz kdepimpi-396aeedb3351ecf9024a3975a5bce9166f0d8aef.tar.bz2 |
wn
-rw-r--r-- | korganizer/main.cpp | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 6 |
2 files changed, 3 insertions, 4 deletions
diff --git a/korganizer/main.cpp b/korganizer/main.cpp index 6339370..a96f7c2 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp @@ -8,108 +8,107 @@ #else #include <qapplication.h> #include <qstring.h> #include <qwindowsstyle.h> #include <qplatinumstyle.h> #include <qsgistyle.h> #include <stdlib.h> #endif #include <qtextcodec.h> #include <qdir.h> #include <kstandarddirs.h> #include <kglobal.h> #include <stdio.h> #include "mainwindow.h" #include <libkdepim/kpimglobalprefs.h> void dumpMissing(); int main( int argc, char **argv ) { #ifndef DESKTOP_VERSION QPEApplication a( argc, argv ); a.setKeepRunning (); #else QApplication a( argc, argv ); QApplication::setStyle( new QPlatinumStyle ()); #ifdef _WIN32_ QString hdir ( getenv( "HOME") ); if ( hdir.isEmpty() ) { QString hd ("C:/" ); //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); if ( QDir::homeDirPath().lower() == hd.lower() ) { _putenv( "HOME=C:"); //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); } } else { QDir app_dir; if ( !app_dir.exists(hdir) ) app_dir.mkdir (hdir); } #endif #endif bool exitHelp = false; if ( argc > 1 ) { QString command = argv[1]; if ( command == "-help" ){ printf("KO/Pi command line commands:\n"); printf(" no command: Start KO/Pi in usual way\n"); printf(" -help: This output\n"); printf("Next Option: Open or Show after start:\n"); printf(" -newTodo: New Todo dialog\n"); printf(" -newEvent: New Event dialog\n"); printf(" -showList: List view\n"); printf(" -showDay: Day view\n"); printf(" -showWWeek: Work Week view\n"); printf(" -showWeek: Week view\n"); printf(" -showTodo: Todo view\n"); printf(" -showJournal: Journal view\n"); printf(" -showKO: Next Days view\n"); printf(" -showWNext: What's Next view\n"); printf(" -showNextXView: Next X View\n"); printf(" -new[Y] and -show[X] may be used togehther\n"); printf(" KO/Pi is exiting now. Bye!\n"); exitHelp = true; } } if ( ! exitHelp ) { KGlobal::setAppName( "korganizer" ); QString fileName ; #ifndef DESKTOP_VERSION fileName = getenv("QPEDIR"); KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); #else fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); #endif KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); KPimGlobalPrefs::instance()->setGlobalConfig(); MainWindow m; #ifndef DESKTOP_VERSION QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(receiveStart( const QCString&, const QByteArray& ))); a.showMainWidget(&m ); #else a.setMainWidget(&m ); m.show(); //m.resize( 800, 600 ); //QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); #endif if ( argc > 1 ) { QCString command = argv[1]; if ( argc > 2 ) command += argv[2]; - qApp->processEvents(); m.recieve(command, QByteArray() ); } a.exec(); dumpMissing(); KPimGlobalPrefs::instance()->writeConfig(); } qDebug("KO: Bye! "); } diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 883a9d1..d1e369c 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -215,288 +215,288 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : tbd = Bottom; else tbd = Top; } else { if ( p->mToolBarUpF ) tbd = Right; else tbd = Left; } filterToolBar = new QPEToolBar ( this ); filterMenubar = new KMenuBar( 0 ); QFontMetrics fm ( filterMenubar->font() ); #ifndef DESKTOP_VERSION filterToolBar->setFocusPolicy( NoFocus ); filterMenubar->setFocusPolicy( NoFocus ); #endif filterPopupMenu = new QPopupMenu( this ); filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); QString addTest = "A"; filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); #ifdef DESKTOP_VERSION addTest = "AAAAAABBBCCCx"; #else addTest = "AAAAAx"; #endif filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); addToolBar (filterToolBar , tbd ); connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) filterToolBar->hide(); } else { filterToolBar = 0; filterMenubar = 0; filterPopupMenu = 0; } if ( p->mShowIconOnetoolbar ) { viewToolBar = iconToolBar ; navigatorToolBar = iconToolBar ; } else { #ifndef DESKTOP_VERSION setToolBarsMovable( false ); #endif if ( p->mToolBarHorV ) { if ( p->mToolBarUpV ) tbd = Bottom; else tbd = Top; } else { if ( p->mToolBarUpV ) tbd = Right; else tbd = Left; } viewToolBar = new QPEToolBar( this ); addToolBar (viewToolBar , tbd ); if ( p->mToolBarHorN ) { if ( p->mToolBarUpN ) tbd = Bottom; else tbd = Top; } else { if ( p->mToolBarUpN ) tbd = Right; else tbd = Left; } navigatorToolBar = new QPEToolBar( this ); addToolBar (navigatorToolBar , tbd ); } mCalendarModifiedFlag = false; // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); //splash->setAlignment ( AlignCenter ); //setCentralWidget( splash ); #ifndef DESKTOP_VERSION //showMaximized(); #endif //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); setDefaultPreferences(); mCalendar = new CalendarLocal(); mView = new CalendarView( mCalendar, this,"mCalendar " ); setCentralWidget( mView ); //mView->hide(); //mView->resize(splash->size() ); initActions(); mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); mSyncManager->setBlockSave(false); mView->setSyncManager(mSyncManager); #ifndef DESKTOP_VERSION - //iconToolBar->show(); - //qApp->processEvents(); + iconToolBar->show(); + qApp->processEvents(); #endif //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); int vh = height() ; int vw = width(); //qDebug("Toolbar hei %d ",iconToolBar->height() ); if ( iconToolBar->orientation () == Qt:: Horizontal ) { vh -= iconToolBar->height(); } else { vw -= iconToolBar->height(); } //mView->setMaximumSize( splash->size() ); //mView->resize( splash->size() ); //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); mView->readSettings(); bool newFile = false; if( !QFile::exists( defaultFileName() ) ) { QFileInfo finfo ( defaultFileName() ); QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 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"; finfo.setFile( oldFile ); if (finfo.exists() ) { KMessageBox::information( this, message); mView->openCalendar( oldFile ); qApp->processEvents(); } else { oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); finfo.setFile( oldFile ); if (finfo.exists() ) { KMessageBox::information( this, message); mView->openCalendar( oldFile ); qApp->processEvents(); } } mView->saveCalendar( defaultFileName() ); newFile = true; } //QTime neededSaveTime = QDateTime::currentDateTime().time(); //mView->loadCalendars(); //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); //qDebug("KO: Calendar loading time: %d ms",msNeeded ); if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { KOPrefs::instance()->setAllDefaults(); } connect( mView, SIGNAL( tempDisableBR(bool) ), SLOT( disableBR(bool) ) ); connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); setCentralWidget( mView ); globalFlagBlockStartup = 0; //mView->show(); //delete splash; if ( newFile ) mView->updateConfig(); // qApp->processEvents(); //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); //fillSyncMenu(); connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); mSyncManager->setDefaultFileName( sentSyncFile()); connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); mSyncManager->fillSyncMenu(); mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); if ( showWarning ) { KMessageBox::information( this, "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"); //qApp->processEvents(); mView->dialogManager()->showSyncOptions(); } //US listen for result adressed from Ka/Pi #ifndef DESKTOP_VERSION infrared = 0; #endif updateFilterToolbar(); updateWeek( mView->startDate() ); connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), SLOT( updateWeekNum( const KCal::DateList & ) ) ); mBRdisabled = false; //toggleBeamReceive(); setCaption(i18n("Loading calendar files ... please wait" )); mSaveDelay = 0; - QTimer::singleShot( 1, this, SLOT ( loadDataAfterStart() )); + QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() )); } MainWindow::~MainWindow() { //qDebug("MainWindow::~MainWindow() "); //save toolbar location delete mCalendar; delete mSyncManager; #ifndef DESKTOP_VERSION if ( infrared ) delete infrared; #endif } void MainWindow::loadDataAfterStart() { qDebug("KO: Start loading files..." ); QTime neededSaveTime = QDateTime::currentDateTime().time(); mView->loadCalendars(); int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); qDebug("KO: Calendar loading time: %d ms",msNeeded ); //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); mView->setModified( false ); mBlockAtStartup = false; mView->setModified( false ); connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); processIncidenceSelection( 0 ); connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), SLOT( processIncidenceSelection( Incidence * ) ) ); connect( mView, SIGNAL( modifiedChanged( bool ) ), SLOT( slotModifiedChanged( bool ) ) ); #ifndef DESKTOP_VERSION connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); if ( !mCStringMess.isEmpty() ) recieve( mCStringMess, mByteData ); #endif QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); } void MainWindow::slotResetFocus() { //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); mFocusLoop = 3; QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); } void MainWindow::slotResetFocusLoop() { --mFocusLoop; QWidget* fw = mView->viewManager()->currentView(); if ( fw ) { //qDebug("loop "); fw->setFocus(); if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); } } void MainWindow::disableBR(bool b) { #ifndef DESKTOP_VERSION if ( b ) { if ( infrared ) { toggleBeamReceive(); mBRdisabled = true; } mBRdisabled = true; } else { if ( mBRdisabled ) { mBRdisabled = false; //makes no sense,because other cal ap is probably running // toggleBeamReceive(); } } #endif } bool MainWindow::beamReceiveEnabled() { #ifndef DESKTOP_VERSION return ( infrared != 0 ); #endif return false; } void MainWindow::toggleBeamReceive() { if ( mBRdisabled ) return; #ifndef DESKTOP_VERSION if ( infrared ) { qDebug("KO: Disable BeamReceive "); delete infrared; infrared = 0; |