summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-08 13:31:08 (UTC)
committer zautrix <zautrix>2004-10-08 13:31:08 (UTC)
commitec5bc1b8c708b55884f1e03861204123de097129 (patch) (side-by-side diff)
tree0c5c8a341fd69ed9b45a22a42b9445da8b56a5e8
parent38e390e51967b34d53e19bd275efd1760572cdfb (diff)
downloadkdepimpi-ec5bc1b8c708b55884f1e03861204123de097129.zip
kdepimpi-ec5bc1b8c708b55884f1e03861204123de097129.tar.gz
kdepimpi-ec5bc1b8c708b55884f1e03861204123de097129.tar.bz2
cleanup
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp38
-rw-r--r--korganizer/calendarview.h4
-rw-r--r--korganizer/mainwindow.cpp4
3 files changed, 13 insertions, 33 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 04051a2..0c35bb3 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -693,21 +693,16 @@ void CalendarView::createPrinter()
#ifndef KORG_NOPRINTER
if (!mCalPrinter) {
mCalPrinter = new CalPrinter(this, mCalendar);
connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
}
#endif
}
-void CalendarView::confSync()
-{
- //DELETE
-}
-
//KOPrefs::instance()->mWriteBackFile
//KOPrefs::instance()->mWriteBackExistingOnly
// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
@@ -1196,16 +1191,17 @@ void CalendarView::setSyncDevice( QString s )
mCurrentSyncDevice= s;
}
void CalendarView::setSyncName( QString s )
{
mCurrentSyncName= s;
}
bool CalendarView::syncCalendar(QString filename, int mode)
{
+ //qDebug("syncCalendar %s ", filename.latin1());
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() ) {
@@ -1222,20 +1218,17 @@ bool CalendarView::syncCalendar(QString filename, int mode)
setModified( true );
}
delete storage;
delete calendar;
if ( syncOK )
updateView();
return syncOK;
}
-void CalendarView::syncPhone()
-{
- //DELETE
-}
+
void CalendarView::syncExternal( int mode )
{
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
qApp->processEvents();
CalendarLocal* calendar = new CalendarLocal();
calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
bool syncOK = false;
@@ -1308,22 +1301,16 @@ void CalendarView::syncExternal( int mode )
question, i18n("Ok")) ;
}
delete calendar;
updateView();
return ;//syncOK;
}
-void CalendarView::syncSharp()
-{
- //DELETE
-
-}
-
bool CalendarView::importBday()
{
#ifndef KORG_NOKABC
#ifdef DESKTOP_VERSION
KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
KABC::AddressBook::Iterator it;
@@ -1584,20 +1571,23 @@ bool CalendarView::openCalendar(QString filename, bool merge)
}
globalFlagBlockAgenda = 2;
// if ( getLastSyncEvent() )
// getLastSyncEvent()->setReadOnly( true );
mCalendar->reInitAlarmSettings();
setSyncEventsReadOnly();
updateUnmanagedViews();
updateView();
- setLoadedFileVersion( QDateTime::currentDateTime().addSecs( -1 ));
if ( filename != MainWindow::defaultFileName() ) {
saveCalendar( MainWindow::defaultFileName() );
- watchSavedFile();
+ } else {
+ QFileInfo finf ( MainWindow::defaultFileName());
+ if ( finf.exists() ) {
+ setLoadedFileVersion( finf.lastModified () );
+ }
}
return true;
} else {
// while failing to load, the calendar object could
// have become partially populated. Clear it out.
if ( !merge ) {
mCalendar->close();
mViewManager->setDocumentId( filename );
@@ -1684,26 +1674,29 @@ 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 );
-
+
+ QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
mStorage->setSaveFormat( new ICalFormat() );
mStorage->setFileName( filename );
bool success;
success = mStorage->save();
if ( !success ) {
return false;
}
-
+ if ( filename == MainWindow::defaultFileName() ) {
+ setLoadedFileVersion( lfv );
+ watchSavedFile();
+ }
return true;
}
void CalendarView::closeCalendar()
{
// child windows no longer valid
emit closingDown();
@@ -2177,21 +2170,16 @@ void CalendarView::edit_paste()
changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
}
void CalendarView::edit_options()
{
mDialogManager->showOptionsDialog();
//writeSettings();
}
-void CalendarView::edit_sync_options()
-{
- // DELETE
-
-}
void CalendarView::slotSelectPickerDate( QDate d)
{
mDateFrame->hide();
if ( mDatePickerMode == 1 ) {
mNavigator->slotDaySelect( d );
} else if ( mDatePickerMode == 2 ) {
if ( mMoveIncidence->type() == "Todo" ) {
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 751b8d9..660cce7 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -315,17 +315,16 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
/** copy the current appointment(s) to the clipboard */
void edit_copy();
/** paste the current vobject(s) in the clipboard buffer into calendar */
void edit_paste();
/** edit viewing and configuration options. */
void edit_options();
- void edit_sync_options();
/**
Functions for printing, previewing a print, and setting up printing
parameters.
*/
void print();
void printSetup();
void printPreview();
@@ -431,18 +430,16 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void purgeCompleted();
bool removeCompletedSubTodos( Todo* );
void slotCalendarChanged();
bool importBday();
bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
bool importQtopia( const QString &categoriesFile,
const QString &datebookFile,
const QString &tasklistFile );
- void syncSharp( );
- void syncPhone( );
void syncExternal( int mode );
void slotSelectPickerDate( QDate ) ;
void showDatePicker( ) ;
void moveIncidence(Incidence *) ;
void beamIncidence(Incidence *) ;
void beamCalendar() ;
void beamFilteredCalendar() ;
void beamIncidenceList(QPtrList<Incidence>) ;
@@ -461,17 +458,16 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
public:
// show a standard warning
// returns KMsgBox::yesNoCancel()
int msgCalModified();
virtual bool sync(KSyncManager* manager, QString filename, int mode);
virtual bool syncExternal(KSyncManager* manager, QString resource);
- void confSync();
void setSyncManager(KSyncManager* manager);
void setLoadedFileVersion(QDateTime);
bool checkFileVersion(QString fn);
bool checkFileChanged(QString fn);
Event* getLastSyncEvent();
/** Adapt navigation units correpsonding to step size of navigation of the
* current view.
*/
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index c7ce8cb..2d17986 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1379,21 +1379,19 @@ void MainWindow::save()
if ( mSyncManager->blockSave() )
return;
mSyncManager->setBlockSave(true);
if ( mView->checkFileVersion( defaultFileName()) ) {
QTime neededSaveTime = QDateTime::currentDateTime().time();
setCaption(i18n("KO/Pi:Saving Data to File ..." ));
qDebug("KO: Start saving data to file!");
- mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
mView->saveCalendar( defaultFileName() );
int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
- mView->watchSavedFile();
qDebug("KO: Needed %d ms for saving.",msNeeded );
QString savemes;
savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
setCaption(savemes);
} else
setCaption(i18n("Saving cancelled!"));
mCalendarModifiedFlag = false;
mSyncManager->setBlockSave( false );
@@ -1816,20 +1814,18 @@ void MainWindow::syncFileRequest()
save();
}
void MainWindow::getFile( bool success )
{
if ( ! success ) {
setCaption( i18n("Error receiving file. Nothing changed!") );
return;
}
- mView->watchSavedFile();
mView->openCalendar( defaultFileName() );
setCaption( i18n("Pi-Sync successful!") );
-
}
void MainWindow::printSel( )
{
mView->viewManager()->agendaView()->agenda()->printSelection();
}
void MainWindow::printCal()