author | zautrix <zautrix> | 2004-10-05 08:07:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-05 08:07:41 (UTC) |
commit | ad859d26b813101adab963f50e694961702561d9 (patch) (side-by-side diff) | |
tree | 36eb7f12ee6ee80f50cdd13bbfaba74e9a1b37d1 /korganizer | |
parent | fc2c103f45a6d4e4105259436266538c645f2c87 (diff) | |
download | kdepimpi-ad859d26b813101adab963f50e694961702561d9.zip kdepimpi-ad859d26b813101adab963f50e694961702561d9.tar.gz kdepimpi-ad859d26b813101adab963f50e694961702561d9.tar.bz2 |
cleanup
-rw-r--r-- | korganizer/calendarview.cpp | 20 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 115 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 2 |
5 files changed, 13 insertions, 126 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index eaea040..fecc7e2 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1212,32 +1212,32 @@ void CalendarView::setSyncName( QString s ) { mCurrentSyncName= s; } bool CalendarView::syncCalendar(QString filename, int mode) { mGlobalSyncMode = SYNC_MODE_NORMAL; CalendarLocal* calendar = new CalendarLocal(); calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); FileStorage* storage = new FileStorage( calendar ); bool syncOK = false; storage->setFileName( filename ); // qDebug("loading ... "); - if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { + if ( storage->load() ) { getEventViewerDialog()->setSyncMode( true ); syncOK = synchronizeCalendar( mCalendar, calendar, mode ); getEventViewerDialog()->setSyncMode( false ); if ( syncOK ) { if ( KOPrefs::instance()->mWriteBackFile ) { - storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); + storage->setSaveFormat( new ICalFormat() ); storage->save(); } } setModified( true ); } delete storage; delete calendar; if ( syncOK ) updateView(); return syncOK; } void CalendarView::syncPhone() @@ -1490,42 +1490,44 @@ bool CalendarView::openCalendar(QString filename, bool merge) } if (!QFile::exists(filename)) { KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); return false; } globalFlagBlockAgenda = 1; if (!merge) mCalendar->close(); mStorage->setFileName( filename ); - if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { + if ( mStorage->load() ) { if ( merge ) ;//setModified( true ); else { //setModified( true ); mViewManager->setDocumentId( filename ); mDialogManager->setDocumentId( filename ); mTodoList->setDocumentId( filename ); } globalFlagBlockAgenda = 2; // if ( getLastSyncEvent() ) // getLastSyncEvent()->setReadOnly( true ); mCalendar->reInitAlarmSettings(); setSyncEventsReadOnly(); updateUnmanagedViews(); updateView(); - if ( filename != MainWindow::defaultFileName() ) - saveCalendar( MainWindow::defaultFileName() ); loadedFileVersion = QDateTime::currentDateTime(); + if ( filename != MainWindow::defaultFileName() ) { + saveCalendar( MainWindow::defaultFileName() ); + watchSavedFile(); + } return true; } else { // while failing to load, the calendar object could // have become partially populated. Clear it out. if ( !merge ) mCalendar->close(); KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); globalFlagBlockAgenda = 2; updateView(); } return false; @@ -1591,25 +1593,25 @@ bool CalendarView::checkFileVersion(QString fn) } bool CalendarView::saveCalendar( QString filename ) { // Store back all unsaved data into calendar object // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); if ( mViewManager->currentView() ) mViewManager->currentView()->flushView(); //mStorage->setFileName( filename ); - mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); + mStorage->setSaveFormat( new ICalFormat() ); mStorage->setFileName( filename ); bool success; success = mStorage->save(); if ( !success ) { return false; } return true; } void CalendarView::closeCalendar() { @@ -2292,25 +2294,25 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) Incidence *in = incidence->clone(); if ( addText ) description += in->summary() + "\n"; cal->addIncidence( in ); incidence = delSel.next(); } if ( beamDialog->beamVcal() ) { fn += ".vcs"; FileStorage storage( cal, fn, new VCalFormat ); storage.save(); } else { fn += ".ics"; - FileStorage storage( cal, fn, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); + FileStorage storage( cal, fn, new ICalFormat( ) ); storage.save(); } delete cal; mes = i18n("KO/Pi: Ready for beaming"); setCaption(mes); #ifndef DESKTOP_VERSION Ir *ir = new Ir( this ); connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); ir->send( fn, description, "text/x-vCalendar" ); #endif } @@ -2847,25 +2849,25 @@ void CalendarView::action_mail() i18n("Can't generate mail:\nNo attendees defined.\n")); return; } CalendarLocal cal_tmp; Event *event = 0; Event *ev = 0; if ( incidence && incidence->type() == "Event" ) { event = static_cast<Event *>(incidence); ev = new Event(*event); cal_tmp.addEvent(ev); } - ICalFormat mForm( KOPrefs::instance()->mUseQuicksave); + ICalFormat mForm(); QString attachment = mForm.toString( &cal_tmp ); if (ev) delete(ev); mailClient.mailAttendees(currentSelection(), attachment); #endif #if 0 Event *anEvent = 0; if (mViewManager->currentView()->isEventView()) { anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); } @@ -3132,25 +3134,25 @@ void CalendarView::printPreview() mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), tmpDateList.last()); #endif } void CalendarView::exportICalendar() { QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); // Force correct extension if (filename.right(4) != ".ics") filename += ".ics"; - FileStorage storage( mCalendar, filename, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); + FileStorage storage( mCalendar, filename, new ICalFormat() ); storage.save(); } bool CalendarView::exportVCalendar( QString filename ) { if (mCalendar->journals().count() > 0) { int result = KMessageBox::warningContinueCancel(this, i18n("The journal entries can not be\nexported to a vCalendar file."), i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), true); if (result != KMessageBox::Continue) return false; } diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 0034715..e0623d5 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -215,25 +215,24 @@ KOPrefs::KOPrefs() : addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); KPrefs::setCurrentGroup("Locale"); addItemInt("PreferredLanguage",&mPreferredLanguage,0); addItemInt("PreferredTime",&mPreferredTime,0); addItemInt("PreferredDate",&mPreferredDate,0); addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); - addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); addItemBool("ShortDateInViewer",&mShortDateInViewer,false); addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); KPrefs::setCurrentGroup("Colors"); addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 696433e..7abd741 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -257,25 +257,24 @@ class KOPrefs : public KPimPrefs bool mHighlightCurrentDay; bool mUseHighlightLightColor; bool mListViewMonthTimespan; bool mWNViewShowsParents; bool mWNViewShowLocation; bool mTodoViewShowsPercentage; bool mTodoViewUsesCatColors; bool mTodoViewUsesSmallFont; bool mTodoViewUsesForegroundColor; bool mMonthViewUsesForegroundColor; bool mHightlightDateTimeEdit; - bool mUseQuicksave; bool mShortDateInViewer; QStringList mLocationDefaults; QStringList mEventSummaryUser; QStringList mTodoSummaryUser; bool mUseInternalAlarmNotification; int mAlarmPlayBeeps; int mAlarmSuspendTime; int mAlarmSuspendCount; int mAlarmBeepInterval; diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 5aa75f5..43ee2d7 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -1943,51 +1943,46 @@ void MainWindow::enableQuick() return; } connect( mServerSocket, SIGNAL ( saveFile() ), this, SLOT ( save() ) ); connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SLOT ( getFile( bool ) ) ); } void MainWindow::getFile( bool success ) { if ( ! success ) { setCaption( i18n("Error receiving file. Nothing changed!") ); return; } - // pending adjust time for watchSavedFile() - //mView->watchSavedFile(); + mView->watchSavedFile(); mView->openCalendar( defaultFileName() ); setCaption( i18n("Pi-Sync successful!") ); } void MainWindow::syncPi() { qApp->processEvents(); - performQuickQuick(); -} - -void MainWindow::performQuickQuick() -{ bool ok; Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok); if ( ! ok ) { setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); return; } KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, KOPrefs::instance()->mActiveSyncIP, this ); connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); setCaption( i18n("Sending request for remote file ...") ); commandSocket->readFile( syncFileName() ); } + void MainWindow::deleteCommandSocket(KCommandSocket*s, int state) { qDebug("MainWindow::deleteCommandSocket %d", state); //enum { success, errorW, errorR, quiet }; if ( state == KCommandSocket::errorR ) { setCaption( i18n("ERROR: Receiving remote file failed.") ); delete s; KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this ); connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); commandSocket->sendStop(); return; @@ -2157,130 +2152,24 @@ void MainWindow::syncRemote( KSyncProfile* prof, bool ask) result = system ( command ); qDebug("KO: Writing back file result: %d ", result); if ( result != 0 ) { setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); return; } else { setCaption ( i18n( "Syncronization sucessfully completed" ) ); } } } return; } -void MainWindow::syncSSH() -{ - // not used anymore - QTime timer; - timer.start(); - //qDebug("MainWindow::syncssh() "); - KOPrefs *p = KOPrefs::instance(); - QString localFile = p->mLocalTempFile; - QString remoteIP = p->mRemoteIP; - QString remoteUser = p->mRemoteUser; - QString remoteFile = p->mRemoteFile; - if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) - remoteUser += ":" + p->mRemotePassWd; - - QString question = i18n("Do you really want\nto remote sync?\n \n") + - i18n("IP: " ) +remoteIP +"\n" + - i18n("User: " ) + remoteUser +"\n" ; - int maxlen = 30; - if ( QApplication::desktop()->width() > 320 ) - maxlen += 25; - if ( remoteFile.length() > maxlen ) - question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; - else - question += i18n("Remote file:\n " ) + remoteFile +"\n"; - if ( localFile.length() > maxlen ) - question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; - else - question += i18n("Local temp file:\n " ) + localFile +"\n"; - - if ( QMessageBox::information( this, i18n("KO/Pi Sync"), - question, - i18n("Yes"), i18n("No"), - 0, 0 ) != 0 ) - return; - // if ( !p->mUsePassWd ) { - // QString pass = getPassword(); - // if ( pass.length() > 0 ) - // remoteUser += ":" + pass; - // } - QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; - setCaption ( i18n( "Copy remote file to local machine..." ) ); - int fileSize = 0; - int result = system ( command ); - // 0 : okay - // 256: no such file or dir - // - qDebug("KO: Remote copy result(0 = okay): %d ",result ); - if ( result != 0 ) { - int len = maxlen; - while ( len < command.length() ) { - command.insert( len , "\n" ); - len += maxlen +2; - } - question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; - QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), - question, - i18n("Okay!")) ; - setCaption ("KO/Pi"); - return; - } - - - setCaption ( i18n( "Copying succeed." ) ); - //mView->setSyncDevice("ssh-scp" ); - if ( syncWithFile(localFile , true ) ) { -// Event* e = mView->getLastSyncEvent(); -// e->setReadOnly( false ); -// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); -// e->setReadOnly( true ); - if ( KOPrefs::instance()->mWriteBackFile ) { - command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; - setCaption ( i18n( "Writing back file ..." ) ); - result = system ( command ); - if ( result != 0 ) { - int len = maxlen; - while ( len < command.length() ) { - command.insert( len , "\n" ); - len += maxlen +2; - } - question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; - QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), - question, - i18n("Okay!")) ; - setCaption ("KO/Pi"); - return; - } else { - setCaption ( i18n( "Syncronization sucessfully completed" ) ); - } - } - } - return; -#if 0 - system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); - while ( timer.elapsed() < 5000 ) - qApp->processEvents(); - - qDebug("MainWindow::merging) "); - mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); - while ( mBlockSaveFlag ) - qApp->processEvents(); - save(); - system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); -#endif - -} - void MainWindow::syncSharp() { if ( mCalendarModifiedFlag ) save(); mView->syncSharp(); slotModifiedChanged( true ); } void MainWindow::syncPhone() { if ( mCalendarModifiedFlag ) diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 4da371e..ba627b9 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h @@ -136,25 +136,24 @@ class MainWindow : public QMainWindow void save(); void configureToolBar( int ); void printSel(); void printCal(); void saveCalendar(); void loadCalendar(); void exportVCalendar(); void fillFilterMenu(); void selectFilter( int ); void slotSyncMenu( int ); - void syncSSH(); void confSync(); void syncSharp(); void syncPhone(); void syncPi(); void syncLocalFile(); bool syncWithFile( QString, bool ); void quickSyncLocalFile(); protected: void displayText( QString, QString); void displayFile( QString, QString); @@ -168,25 +167,24 @@ class MainWindow : public QMainWindow void deleteCommandSocket(KCommandSocket* s, int state ); void fillSyncMenu(); void getFile( bool ); void readFileFromSocket(); private: //QTimer* mTimerCommandSocket; QString mPassWordPiSync; KServerSocket * mServerSocket; bool mClosed; void saveOnClose(); int mCurrentSyncProfile; void enableQuick(); - void performQuickQuick(); void syncRemote( KSyncProfile* , bool ask = true); bool mFlagKeyPressed; bool mBlockAtStartup; QPEToolBar *iconToolBar; void initActions(); void setDefaultPreferences(); void keyPressEvent ( QKeyEvent * ) ; void keyReleaseEvent ( QKeyEvent * ) ; QPopupMenu *configureToolBarMenu; QPopupMenu *selectFilterMenu; QPopupMenu *configureAgendaMenu, *syncMenu; CalendarLocal *mCalendar; |