summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 40f2cf4..be69be7 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -28,52 +28,53 @@
#include <qapplication.h>
//#include <resource.h>
#endif
#include <libkcal/calendarlocal.h>
#include <libkcal/todo.h>
#include <libkdepim/ksyncprofile.h>
#include <libkdepim/kincidenceformatter.h>
#include "calendarview.h"
#include "koviewmanager.h"
#include "datenavigator.h"
#include "koagendaview.h"
#include "koagenda.h"
#include "kodialogmanager.h"
#include "kdialogbase.h"
#include "kstandarddirs.h"
#include "koprefs.h"
#include "kfiledialog.h"
#include "koglobals.h"
#include "kglobal.h"
#include "klocale.h"
#include "kconfig.h"
#include "simplealarmclient.h"
-
using namespace KCal;
#ifndef _WIN32_
#include <unistd.h>
+#else
+#include "koimportoldialog.h"
#endif
#include "mainwindow.h"
int globalFlagBlockStartup;
MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
QMainWindow( parent, name )
{
#ifdef DESKTOP_VERSION
setFont( QFont("Arial"), 14 );
#endif
//QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
QString confFile = locateLocal("config","korganizerrc");
QFileInfo finf ( confFile );
bool showWarning = !finf.exists();
setIcon(SmallIcon( "ko24" ) );
mBlockAtStartup = true;
mFlagKeyPressed = false;
setCaption("KOrganizer/Pi");
KOPrefs *p = KOPrefs::instance();
// if ( QApplication::desktop()->height() > 480 ) {
// if ( p->mHourSize == 4 )
// p->mHourSize = 6;
@@ -563,48 +564,56 @@ void MainWindow::initActions()
actionMenu->insertSeparator();
actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
}
// actionMenu->insertSeparator();
action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
action = new QAction( "import_quick", i18n("Import last file"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
importMenu->insertSeparator();
action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
#ifndef DESKTOP_VERSION
importMenu->insertSeparator();
action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
+#else
+#ifdef _WIN32_
+ importMenu->insertSeparator();
+ action = new QAction( "import_ol", i18n("Import from OL"), 0,
+ this );
+ action->addTo( importMenu );
+ connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
+#endif
#endif
importMenu->insertSeparator();
action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
importMenu->insertSeparator();
action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
this );
action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
importMenu->insertSeparator();
action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
#ifndef DESKTOP_VERSION
importMenu->insertSeparator();
@@ -909,49 +918,51 @@ void MainWindow::multiSync( bool askforPrefs )
mView->setSyncDevice(i18n("Multiple profiles") );
KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
if ( askforPrefs ) {
mView->edit_sync_options();
KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
}
setCaption(i18n("Multiple sync started.") );
qApp->processEvents();
int num = ringSync() ;
if ( num > 1 )
ringSync();
mBlockSaveFlag = false;
if ( num )
save();
if ( num )
setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
else
setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
return;
}
void MainWindow::slotSyncMenu( int action )
{
//qDebug("syncaction %d ", action);
if ( action == 0 ) {
+
confSync();
+
return;
}
if ( action == 1 ) {
multiSync( true );
return;
}
if (mBlockSaveFlag)
return;
mBlockSaveFlag = true;
mCurrentSyncProfile = action - 1000 ;
mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
KConfig *config = KOGlobals::config();
KSyncProfile* temp = new KSyncProfile ();
temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
temp->readConfig(config);
KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
if ( action == 1000 ) {
syncSharp();
@@ -1198,48 +1209,57 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
mNewSubTodoAction->setEnabled( false );
} else if ( incidence->type() == "Todo" ) {
mShowAction->setText( i18n("Show Todo...") );
mEditAction->setText( i18n("Edit Todo...") );
mDeleteAction->setText( i18n("Delete Todo...") );
mNewSubTodoAction->setEnabled( true );
} else {
mShowAction->setText( i18n("Show...") );
mShowAction->setText( i18n("Edit...") );
mShowAction->setText( i18n("Delete...") );
mNewSubTodoAction->setEnabled( false );
}
}
void MainWindow::enableIncidenceActions( bool enabled )
{
mShowAction->setEnabled( enabled );
mEditAction->setEnabled( enabled );
mDeleteAction->setEnabled( enabled );
}
+void MainWindow::importOL()
+{
+#ifdef _WIN32_
+ KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
+ id->exec();
+ delete id;
+ mView->updateView();
+#endif
+}
void MainWindow::importBday()
{
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
i18n("Import!"), i18n("Cancel"), 0,
0, 1 );
if ( result == 0 ) {
mView->importBday();
}
}
void MainWindow::importQtopia()
{
#ifndef DESKTOP_VERSION
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
i18n("Import!"), i18n("Cancel"), 0,
0, 1 );
if ( result == 0 ) {
QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";