summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp12
-rw-r--r--korganizer/mainwindow.cpp48
-rw-r--r--korganizer/mainwindow.h2
3 files changed, 42 insertions, 20 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 6e61351..4667918 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1149,101 +1149,105 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
inR = er.first();
QDateTime dt;
QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 );
while ( inR ) {
if ( inR->type() == "Todo" ) {
Todo * t = (Todo*)inR;
if ( t->hasDueDate() )
dt = t->dtDue();
else
dt = cur.addSecs( 62 );
}
else if (inR->type() == "Event" ) {
bool ok;
dt = inR->getNextOccurence( cur, &ok );
if ( !ok )
dt = cur.addSecs( -62 );
}
else
dt = inR->dtStart();
if ( dt < cur || dt > end ) {
remote->deleteIncidence( inR );
++delFut;
}
inR = er.next();
}
}
bar.hide();
mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
eventLSync->setReadOnly( false );
eventLSync->setDtStart( mLastCalendarSync );
eventRSync->setDtStart( mLastCalendarSync );
eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
eventLSync->setReadOnly( true );
if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
remote->addEvent( eventRSync );
else
delete eventRSync;
QString mes;
mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
QString delmess;
if ( delFut ) {
delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut);
mes += delmess;
}
+ mCalendar->checkAlarmForIncidence( 0, true );
+ qDebug( mes );
if ( mSyncManager->mShowSyncSummary ) {
- KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
+ if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
+ i18n("KO/Pi Synchronization"),i18n("Write back"))) {
+ qDebug("cancelled ");
+ return false;
+ }
}
- qDebug( mes );
- mCalendar->checkAlarmForIncidence( 0, true );
return syncOK;
}
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(KPimGlobalPrefs::instance()->mTimeZoneId);
FileStorage* storage = new FileStorage( calendar );
bool syncOK = false;
storage->setFileName( filename );
// qDebug("loading ... ");
if ( storage->load() ) {
getEventViewerDialog()->setSyncMode( true );
syncOK = synchronizeCalendar( mCalendar, calendar, mode );
getEventViewerDialog()->setSyncMode( false );
if ( syncOK ) {
if ( mSyncManager->mWriteBackFile )
{
storage->setSaveFormat( new ICalFormat() );
storage->save();
}
}
setModified( true );
}
delete storage;
delete calendar;
if ( syncOK )
updateView();
return syncOK;
}
void CalendarView::syncExternal( int mode )
{
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
qApp->processEvents();
CalendarLocal* calendar = new CalendarLocal();
calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
@@ -1267,96 +1271,98 @@ void CalendarView::syncExternal( int mode )
loadSuccess = phoneFormat->load( calendar,mCalendar);
} else {
emit tempDisableBR(false);
return;
}
if ( loadSuccess ) {
getEventViewerDialog()->setSyncMode( true );
syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
getEventViewerDialog()->setSyncMode( false );
qApp->processEvents();
if ( syncOK ) {
if ( mSyncManager->mWriteBackFile )
{
QPtrList<Incidence> iL = mCalendar->rawIncidences();
Incidence* inc = iL.first();
if ( phoneFormat ) {
while ( inc ) {
inc->removeID(mCurrentSyncDevice);
inc = iL.next();
}
}
#ifndef DESKTOP_VERSION
if ( sharpFormat )
sharpFormat->save(calendar);
#endif
if ( phoneFormat )
phoneFormat->save(calendar);
iL = calendar->rawIncidences();
inc = iL.first();
Incidence* loc;
while ( inc ) {
if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
loc = mCalendar->incidence(inc->uid() );
if ( loc ) {
loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
}
}
inc = iL.next();
}
Incidence* lse = getLastSyncEvent();
if ( lse ) {
lse->setReadOnly( false );
lse->setDescription( "" );
lse->setReadOnly( true );
}
}
+ } else {
+ topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
}
setModified( true );
} else {
QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
question, i18n("Ok")) ;
}
delete calendar;
updateView();
emit tempDisableBR(false);
return ;//syncOK;
}
bool CalendarView::importBday()
{
#ifndef KORG_NOKABC
#ifdef DESKTOP_VERSION
KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
KABC::AddressBook::Iterator it;
int count = 0;
for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
++count;
}
QProgressBar bar(count,0 );
int w = 300;
if ( QApplication::desktop()->width() < 320 )
w = 220;
int h = bar.sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar.show();
bar.setCaption (i18n("Reading addressbook - close to abort!") );
qApp->processEvents();
count = 0;
int addCount = 0;
KCal::Attendee* a = 0;
for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
if ( ! bar.isVisible() )
return false;
bar.setProgress( count++ );
qApp->processEvents();
//qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
if ( (*it).birthday().date().isValid() ){
a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index fc2d59b..65566b5 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -804,138 +804,145 @@ void MainWindow::initActions()
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();
brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
this );
brAction->addTo( importMenu );
brAction->setToggleAction (true ) ;
connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
#else
importMenu->insertSeparator();
icon = loadPixmap( pathString + "print" );
action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ),
this, SLOT( printCal() ) );
icon = loadPixmap( pathString + "print" );
action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ),
this, SLOT( printSel() ) );
#endif
importMenu->insertSeparator();
action = new QAction( "beam all", i18n("Save"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
action = new QAction( "beam all", i18n("Exit (+save)"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
//menuBar->insertItem( "Configure",configureMenu );
//configureMenu->insertItem( "Toolbar",configureToolBarMenu );
icon = loadPixmap( "korganizer/korganizer" );
- action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
+
+ action = new QAction( "Whats New", i18n("What's new?"), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
- SLOT( keyBindings() ) );
+ SLOT( whatsNew() ) );
action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( features() ) );
+ action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
+ action->addTo( helpMenu );
+ connect( action, SIGNAL( activated() ),
+ SLOT( keyBindings() ) );
+ action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
+ action->addTo( helpMenu );
+ connect( action, SIGNAL( activated() ),
+ SLOT( synchowto() ) );
+ action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
+ action->addTo( helpMenu );
+ connect( action, SIGNAL( activated() ),
+ SLOT( kdesynchowto() ) );
+ action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
+ action->addTo( helpMenu );
+ connect( action, SIGNAL( activated() ),
+ SLOT( multisynchowto() ) );
action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( aboutAutoSaving() ) );
action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( aboutKnownBugs() ) );
action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( usertrans() ) );
- action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
- action->addTo( helpMenu );
- connect( action, SIGNAL( activated() ),
- SLOT( synchowto() ) );
- action = new QAction( "Whats New", i18n("What's new?"), 0,this );
- action->addTo( helpMenu );
- connect( action, SIGNAL( activated() ),
- SLOT( whatsNew() ) );
action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( faq() ) );
-
-
- action = new QAction( "about", i18n("About..."), 0, this );
- action->addTo( helpMenu );
- connect( action, SIGNAL( activated() ),
- SLOT( about() ) );
action = new QAction( "licence", i18n("Licence..."), 0, this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( licence() ) );
+ action = new QAction( "about", i18n("About..."), 0, this );
+ action->addTo( helpMenu );
+ connect( action, SIGNAL( activated() ),
+ SLOT( about() ) );
//menuBar->insertSeparator();
// ******************************************************
// menubar icons
iconToolBar->setHorizontalStretchable (true );
//menuBar->insertItem( iconToolBar );
//xdays_action
if (p-> mShowIconNewEvent)
ne_action->addTo( iconToolBar );
if (p->mShowIconNewTodo )
nt_action->addTo( iconToolBar );
if (p-> mShowIconSearch)
search_action->addTo( iconToolBar );
if (p-> mShowIconNext)
whatsnext_action->addTo( iconToolBar );
if (p-> mShowIconNextDays)
xdays_action->addTo( iconToolBar );
if (p-> mShowIconList)
showlist_action->addTo( iconToolBar );
if (p-> mShowIconDay1)
day1_action->addTo( iconToolBar );
if (p-> mShowIconDay5)
day5_action->addTo( iconToolBar );
if (p-> mShowIconDay7)
day7_action->addTo( iconToolBar );
if (p-> mShowIconMonth)
month_action->addTo( iconToolBar );
if (p-> mShowIconTodoview)
todoview_action->addTo( iconToolBar );
if (p-> mShowIconJournal)
viewjournal_action->addTo( iconToolBar );
icon = loadPixmap( pathString + "2leftarrowB" );
configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
if (p-> mShowIconBackFast) {
action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
connect( action, SIGNAL( activated() ),
mView, SLOT( goPreviousMonth() ) );
action->addTo( iconToolBar );
}
icon = loadPixmap( pathString + "1leftarrowB" );
configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
if (p-> mShowIconBack) {
action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
connect( action, SIGNAL( activated() ),
mView, SLOT( goPrevious() ) );
action->addTo( iconToolBar );
@@ -1102,99 +1109,106 @@ void MainWindow::setDefaultPreferences()
QString MainWindow::resourcePath()
{
return KGlobal::iconLoader()->iconPath();
}
void MainWindow::displayText( QString text ,QString cap )
{
QDialog dia( this, "name", true ); ;
dia.setCaption( cap );
QVBoxLayout* lay = new QVBoxLayout( &dia );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QTextBrowser tb ( &dia );
lay->addWidget( &tb );
tb.setText( text );
#ifdef DESKTOP_VERSION
dia.resize( 640, 480);
#else
dia.showMaximized();
#endif
dia.exec();
}
void MainWindow::displayFile( QString fn, QString cap )
{
QString fileName = resourcePath() + fn;
QString text;
QFile file( fileName );
if (!file.open( IO_ReadOnly ) ) {
return ;
}
QTextStream ts( &file );
text = ts.read();
file.close();
displayText( text, cap);
}
void MainWindow::features()
{
displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
}
void MainWindow::usertrans()
{
displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
}
+void MainWindow::kdesynchowto()
+{
+ KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
+}
+void MainWindow::multisynchowto()
+{
+ KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
+}
void MainWindow::synchowto()
{
-
KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
}
void MainWindow::faq()
{
displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
}
void MainWindow::whatsNew()
{
KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
}
void MainWindow::licence()
{
KApplication::showLicence();
}
void MainWindow::about()
{
QString version;
#include <../version>
QMessageBox::about( this, i18n("About KOrganizer/Pi"),
i18n("KOrganizer/Platform-independent\n") +
"(KO/Pi) " + version + " - " +
#ifdef DESKTOP_VERSION
i18n("Desktop Edition\n") +
#else
i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
#endif
i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
}
void MainWindow::keyBindings()
{
QString cap = i18n("Key bindings KOrganizer/Pi");
QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 0926313..ed65d36 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -8,96 +8,98 @@
#include <qtextstream.h>
#include <qregexp.h>
#include <libkcal/incidence.h>
#include "simplealarmclient.h"
#include <ksyncmanager.h>
#ifndef DESKTOP_VERSION
#include <qcopchannel_qws.h>
#endif
class QAction;
class CalendarView;
class KSyncProfile;
#ifdef DESKTOP_VERSION
#define QPEToolBar QToolBar
#define QPEMenuBar QMenuBar
#endif
class QPEToolBar;
namespace KCal {
class CalendarLocal;
}
using namespace KCal;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
~MainWindow();
bool beamReceiveEnabled();
public slots:
virtual void showMaximized ();
void configureAgenda( int );
void recieve( const QCString& msg, const QByteArray& data );
static QString defaultFileName();
static QString syncFileName();
static QString resourcePath();
protected slots:
void setCaptionToDates();
void about();
void licence();
void faq();
void usertrans();
void features();
void synchowto();
+ void kdesynchowto();
+ void multisynchowto();
void whatsNew();
void keyBindings();
void aboutAutoSaving();;
void aboutKnownBugs();
void processIncidenceSelection( Incidence * );
void importQtopia();
void importBday();
void importOL();
void importIcal();
void importFile( QString, bool );
void quickImportIcal();
void slotModifiedChanged( bool );
void save();
void configureToolBar( int );
void printSel();
void printCal();
void saveCalendar();
void loadCalendar();
void exportVCalendar();
void fillFilterMenu();
void selectFilter( int );
void exportToPhone( int );
void toggleBeamReceive();
void disableBR(bool);
protected:
void displayText( QString, QString);
void displayFile( QString, QString);
void enableIncidenceActions( bool );
private slots:
QSocket* piSocket;
QString piFileString;
QTime piTime;
void getFile( bool );
void syncFileRequest();
private:
bool mBRdisabled;
#ifndef DESKTOP_VERSION
QCopChannel* infrared;
#endif
QAction* brAction;