summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-22 23:36:37 (UTC)
committer zautrix <zautrix>2004-09-22 23:36:37 (UTC)
commite2bc785d2f98d2aeac6ab6a5e39ff4f6e679517b (patch) (unidiff)
treef45771acfd61a0ddda6b253082f243acac473d33
parent772411a6c16f9b2299bd173116faeb4482325bcc (diff)
downloadkdepimpi-e2bc785d2f98d2aeac6ab6a5e39ff4f6e679517b.zip
kdepimpi-e2bc785d2f98d2aeac6ab6a5e39ff4f6e679517b.tar.gz
kdepimpi-e2bc785d2f98d2aeac6ab6a5e39ff4f6e679517b.tar.bz2
bugfixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp32
-rw-r--r--korganizer/mainwindow.h1
2 files changed, 19 insertions, 14 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index ebe761a..2e6b5c8 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,171 +1,172 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qmessagebox.h> 7#include <qmessagebox.h>
8#include <qlineedit.h> 8#include <qlineedit.h>
9#include <qtextcodec.h> 9#include <qtextcodec.h>
10#include <qfile.h> 10#include <qfile.h>
11#include <qdir.h> 11#include <qdir.h>
12#include <qapp.h> 12#include <qapp.h>
13#include <qfileinfo.h> 13#include <qfileinfo.h>
14#include <qlabel.h> 14#include <qlabel.h>
15#include <qmap.h> 15#include <qmap.h>
16#include <qwmatrix.h> 16#include <qwmatrix.h>
17#include <qtextbrowser.h> 17#include <qtextbrowser.h>
18#include <qtextstream.h> 18#include <qtextstream.h>
19#ifndef DESKTOP_VERSION 19#ifndef DESKTOP_VERSION
20#include <qpe/global.h> 20#include <qpe/global.h>
21#include <qpe/qpemenubar.h> 21#include <qpe/qpemenubar.h>
22#include <qpe/qpetoolbar.h> 22#include <qpe/qpetoolbar.h>
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qtopia/alarmserver.h> 25#include <qtopia/alarmserver.h>
26#include <qtopia/qcopenvelope_qws.h> 26#include <qtopia/qcopenvelope_qws.h>
27#else 27#else
28#include <qmenubar.h> 28#include <qmenubar.h>
29#include <qtoolbar.h> 29#include <qtoolbar.h>
30#include <qapplication.h> 30#include <qapplication.h>
31//#include <resource.h> 31//#include <resource.h>
32 32
33#endif 33#endif
34#include <libkcal/calendarlocal.h> 34#include <libkcal/calendarlocal.h>
35#include <libkcal/todo.h> 35#include <libkcal/todo.h>
36#include <libkdepim/ksyncprofile.h> 36#include <libkdepim/ksyncprofile.h>
37#include <libkcal/kincidenceformatter.h> 37#include <libkcal/kincidenceformatter.h>
38#include <libkdepim/kpimglobalprefs.h> 38#include <libkdepim/kpimglobalprefs.h>
39 39
40#include "calendarview.h" 40#include "calendarview.h"
41#include "koviewmanager.h" 41#include "koviewmanager.h"
42#include "datenavigator.h" 42#include "datenavigator.h"
43#include "koagendaview.h" 43#include "koagendaview.h"
44#include "koagenda.h" 44#include "koagenda.h"
45#include "kodialogmanager.h" 45#include "kodialogmanager.h"
46#include "kdialogbase.h" 46#include "kdialogbase.h"
47#include "kapplication.h" 47#include "kapplication.h"
48#include "kofilterview.h" 48#include "kofilterview.h"
49#include "kstandarddirs.h" 49#include "kstandarddirs.h"
50#include "koprefs.h" 50#include "koprefs.h"
51#include "kfiledialog.h" 51#include "kfiledialog.h"
52#include "koglobals.h" 52#include "koglobals.h"
53#include "kglobal.h" 53#include "kglobal.h"
54#include "klocale.h" 54#include "klocale.h"
55#include "kconfig.h" 55#include "kconfig.h"
56#include "simplealarmclient.h" 56#include "simplealarmclient.h"
57#include "externalapphandler.h" 57#include "externalapphandler.h"
58 58
59using namespace KCal; 59using namespace KCal;
60#ifndef _WIN32_ 60#ifndef _WIN32_
61#include <unistd.h> 61#include <unistd.h>
62#else 62#else
63#include "koimportoldialog.h" 63#include "koimportoldialog.h"
64#endif 64#endif
65#include "mainwindow.h" 65#include "mainwindow.h"
66 66
67int globalFlagBlockStartup; 67int globalFlagBlockStartup;
68MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 68MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
69 QMainWindow( parent, name ) 69 QMainWindow( parent, name )
70{ 70{
71 71
72#ifdef DESKTOP_VERSION 72#ifdef DESKTOP_VERSION
73 setFont( QFont("Arial"), 14 ); 73 setFont( QFont("Arial"), 14 );
74#endif 74#endif
75 mCommandSocket = 0; 75 mCommandSocket = 0;
76 mCommandSocketFinish = 0;
76 mSyncActionDialog = 0; 77 mSyncActionDialog = 0;
77 mServerSocket = 0; 78 mServerSocket = 0;
78 mClosed = false; 79 mClosed = false;
79 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 80 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
80 QString confFile = locateLocal("config","korganizerrc"); 81 QString confFile = locateLocal("config","korganizerrc");
81 QFileInfo finf ( confFile ); 82 QFileInfo finf ( confFile );
82 bool showWarning = !finf.exists(); 83 bool showWarning = !finf.exists();
83 setIcon(SmallIcon( "ko24" ) ); 84 setIcon(SmallIcon( "ko24" ) );
84 mBlockAtStartup = true; 85 mBlockAtStartup = true;
85 mFlagKeyPressed = false; 86 mFlagKeyPressed = false;
86 setCaption("KOrganizer/Pi"); 87 setCaption("KOrganizer/Pi");
87 KOPrefs *p = KOPrefs::instance(); 88 KOPrefs *p = KOPrefs::instance();
88 KPimGlobalPrefs::instance()->setGlobalConfig(); 89 KPimGlobalPrefs::instance()->setGlobalConfig();
89 // if ( QApplication::desktop()->height() > 480 ) { 90 // if ( QApplication::desktop()->height() > 480 ) {
90// if ( p->mHourSize == 4 ) 91// if ( p->mHourSize == 4 )
91// p->mHourSize = 6; 92// p->mHourSize = 6;
92// } 93// }
93 if ( p->mHourSize > 18 ) 94 if ( p->mHourSize > 18 )
94 p->mHourSize = 18; 95 p->mHourSize = 18;
95 QMainWindow::ToolBarDock tbd; 96 QMainWindow::ToolBarDock tbd;
96 if ( p->mToolBarHor ) { 97 if ( p->mToolBarHor ) {
97 if ( p->mToolBarUp ) 98 if ( p->mToolBarUp )
98 tbd = Bottom; 99 tbd = Bottom;
99 else 100 else
100 tbd = Top; 101 tbd = Top;
101 } 102 }
102 else { 103 else {
103 if ( p->mToolBarUp ) 104 if ( p->mToolBarUp )
104 tbd = Right; 105 tbd = Right;
105 else 106 else
106 tbd = Left; 107 tbd = Left;
107 } 108 }
108 if ( KOPrefs::instance()->mUseAppColors ) 109 if ( KOPrefs::instance()->mUseAppColors )
109 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 110 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
110 globalFlagBlockStartup = 1; 111 globalFlagBlockStartup = 1;
111 iconToolBar = new QPEToolBar( this ); 112 iconToolBar = new QPEToolBar( this );
112 addToolBar (iconToolBar , tbd ); 113 addToolBar (iconToolBar , tbd );
113 mBlockSaveFlag = false; 114 mBlockSaveFlag = false;
114 mCalendarModifiedFlag = false; 115 mCalendarModifiedFlag = false;
115 116
116 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 117 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
117 splash->setAlignment ( AlignCenter ); 118 splash->setAlignment ( AlignCenter );
118 setCentralWidget( splash ); 119 setCentralWidget( splash );
119#ifndef DESKTOP_VERSION 120#ifndef DESKTOP_VERSION
120 showMaximized(); 121 showMaximized();
121#endif 122#endif
122 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 123 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
123 setDefaultPreferences(); 124 setDefaultPreferences();
124 mCalendar = new CalendarLocal(); 125 mCalendar = new CalendarLocal();
125 mView = new CalendarView( mCalendar, this,"mCalendar " ); 126 mView = new CalendarView( mCalendar, this,"mCalendar " );
126 mView->hide(); 127 mView->hide();
127 //mView->resize(splash->size() ); 128 //mView->resize(splash->size() );
128 initActions(); 129 initActions();
129#ifndef DESKTOP_VERSION 130#ifndef DESKTOP_VERSION
130 iconToolBar->show(); 131 iconToolBar->show();
131 qApp->processEvents(); 132 qApp->processEvents();
132#endif 133#endif
133 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 134 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
134 int vh = height() ; 135 int vh = height() ;
135 int vw = width(); 136 int vw = width();
136 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 137 //qDebug("Toolbar hei %d ",iconToolBar->height() );
137 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 138 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
138 vh -= iconToolBar->height(); 139 vh -= iconToolBar->height();
139 } else { 140 } else {
140 vw -= iconToolBar->height(); 141 vw -= iconToolBar->height();
141 } 142 }
142 //mView->setMaximumSize( splash->size() ); 143 //mView->setMaximumSize( splash->size() );
143 //mView->resize( splash->size() ); 144 //mView->resize( splash->size() );
144 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 145 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
145 mView->readSettings(); 146 mView->readSettings();
146 bool oldOpened = false; 147 bool oldOpened = false;
147 bool newFile = false; 148 bool newFile = false;
148 if( !QFile::exists( defaultFileName() ) ) { 149 if( !QFile::exists( defaultFileName() ) ) {
149 QFileInfo finfo ( defaultFileName() ); 150 QFileInfo finfo ( defaultFileName() );
150 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 151 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
151 qDebug("oldfile %s ", oldFile.latin1()); 152 qDebug("oldfile %s ", oldFile.latin1());
152 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"; 153 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";
153 finfo.setFile( oldFile ); 154 finfo.setFile( oldFile );
154 if (finfo.exists() ) { 155 if (finfo.exists() ) {
155 KMessageBox::information( this, message); 156 KMessageBox::information( this, message);
156 mView->openCalendar( oldFile ); 157 mView->openCalendar( oldFile );
157 qApp->processEvents(); 158 qApp->processEvents();
158 } else { 159 } else {
159 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 160 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
160 finfo.setFile( oldFile ); 161 finfo.setFile( oldFile );
161 if (finfo.exists() ) { 162 if (finfo.exists() ) {
162 KMessageBox::information( this, message); 163 KMessageBox::information( this, message);
163 mView->openCalendar( oldFile ); 164 mView->openCalendar( oldFile );
164 qApp->processEvents(); 165 qApp->processEvents();
165 } 166 }
166 } 167 }
167 mView->saveCalendar( defaultFileName() ); 168 mView->saveCalendar( defaultFileName() );
168 newFile = true; 169 newFile = true;
169 } 170 }
170 171
171 QTime neededSaveTime = QDateTime::currentDateTime().time(); 172 QTime neededSaveTime = QDateTime::currentDateTime().time();
@@ -1888,378 +1889,381 @@ QString MainWindow::getPassword( )
1888 dia.hide(); 1889 dia.hide();
1889 qApp->processEvents(); 1890 qApp->processEvents();
1890 return retfile; 1891 return retfile;
1891 1892
1892} 1893}
1893 1894
1894void MainWindow::enableQuick() 1895void MainWindow::enableQuick()
1895{ 1896{
1896 QString retfile = ""; 1897 QString retfile = "";
1897 QDialog dia ( this, "input-dialog", true ); 1898 QDialog dia ( this, "input-dialog", true );
1898 QLineEdit lab ( &dia ); 1899 QLineEdit lab ( &dia );
1899 QVBoxLayout lay( &dia ); 1900 QVBoxLayout lay( &dia );
1900 lab.setText( KOPrefs::instance()->mPassiveSyncPort ); 1901 lab.setText( KOPrefs::instance()->mPassiveSyncPort );
1901 lay.setMargin(7); 1902 lay.setMargin(7);
1902 lay.setSpacing(7); 1903 lay.setSpacing(7);
1903 QLabel label ( i18n("Port number (Default: 9197)"), &dia ); 1904 QLabel label ( i18n("Port number (Default: 9197)"), &dia );
1904 lay.addWidget( &label); 1905 lay.addWidget( &label);
1905 lay.addWidget( &lab); 1906 lay.addWidget( &lab);
1906 dia.setFixedSize( 230,80 ); 1907 dia.setFixedSize( 230,80 );
1907 dia.setCaption( i18n("Enter port for Easy-Pi-Sync") ); 1908 dia.setCaption( i18n("Enter port for Easy-Pi-Sync") );
1908 QPushButton pb ( "OK", &dia); 1909 QPushButton pb ( "OK", &dia);
1909 lay.addWidget( &pb ); 1910 lay.addWidget( &pb );
1910 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 1911 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
1911 dia.show(); 1912 dia.show();
1912 int res = dia.exec(); 1913 int res = dia.exec();
1913 if ( res ) 1914 if ( res )
1914 retfile = lab.text(); 1915 retfile = lab.text();
1915 else 1916 else
1916 return; 1917 return;
1917 dia.hide(); 1918 dia.hide();
1918 qApp->processEvents(); 1919 qApp->processEvents();
1919 KOPrefs::instance()->mPassiveSyncPort = retfile; 1920 KOPrefs::instance()->mPassiveSyncPort = retfile;
1920 bool ok; 1921 bool ok;
1921 Q_UINT16 port = retfile.toUInt(&ok); 1922 Q_UINT16 port = retfile.toUInt(&ok);
1922 if ( ! ok ) { 1923 if ( ! ok ) {
1923 qDebug("no valid port "); 1924 qDebug("no valid port ");
1924 return; 1925 return;
1925 } 1926 }
1926 qDebug("port %d ", port); 1927 qDebug("port %d ", port);
1927 mServerSocket = new KServerSocket ( port ,1 ); 1928 mServerSocket = new KServerSocket ( port ,1 );
1928 qDebug("connected "); 1929 qDebug("connected ");
1929 if ( !mServerSocket->ok() ) { 1930 if ( !mServerSocket->ok() ) {
1930 qWarning("Failed to bind to port %d", port); 1931 qWarning("Failed to bind to port %d", port);
1931 delete mServerSocket; 1932 delete mServerSocket;
1932 mServerSocket = 0; 1933 mServerSocket = 0;
1933 return; 1934 return;
1934 } 1935 }
1935 connect( mServerSocket, SIGNAL ( sendFile(QSocket*) ), this, SLOT ( sendFile(QSocket*) ) ); 1936 connect( mServerSocket, SIGNAL ( sendFile(QSocket*) ), this, SLOT ( sendFile(QSocket*) ) );
1936 connect( mServerSocket, SIGNAL ( getFile(QSocket*) ), this, SLOT ( getFile(QSocket*) ) ); 1937 connect( mServerSocket, SIGNAL ( getFile(QSocket*) ), this, SLOT ( getFile(QSocket*) ) );
1937} 1938}
1938void MainWindow::sendFile(QSocket* socket) 1939void MainWindow::sendFile(QSocket* socket)
1939{ 1940{
1940 setCaption( i18n("Received request for file") ); 1941 setCaption( i18n("Received request for file") );
1941 qDebug("MainWindow::sendFile(QSocket* s) "); 1942 qDebug("MainWindow::sendFile(QSocket* s) ");
1942 if ( mSyncActionDialog ) 1943 if ( mSyncActionDialog )
1943 delete mSyncActionDialog; 1944 delete mSyncActionDialog;
1944 mSyncActionDialog = new QDialog ( this, "input-dialog", true ); 1945 mSyncActionDialog = new QDialog ( this, "input-dialog", true );
1945 mSyncActionDialog->setCaption(i18n("KO/Pi - WARNING")); 1946 mSyncActionDialog->setCaption(i18n("KO/Pi - WARNING"));
1946 QLabel* label = new QLabel( i18n("Synchronizing...\nDo not use\nthis application!\n"), mSyncActionDialog ); 1947 QLabel* label = new QLabel( i18n("Synchronizing...\nDo not use\nthis application!\n"), mSyncActionDialog );
1947 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); 1948 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog );
1948 lay->addWidget( label); 1949 lay->addWidget( label);
1949 lay->setMargin(7); 1950 lay->setMargin(7);
1950 lay->setSpacing(7); 1951 lay->setSpacing(7);
1951 mSyncActionDialog->setFixedSize( 200,100 ); 1952 mSyncActionDialog->setFixedSize( 200,100 );
1952 mSyncActionDialog->show(); 1953 mSyncActionDialog->show();
1953 qApp->processEvents(); 1954 qApp->processEvents();
1954 qDebug("saving ... "); 1955 qDebug("saving ... ");
1955 save(); 1956 save();
1956 QString fileName = defaultFileName(); 1957 QString fileName = defaultFileName();
1957 QFile file( fileName ); 1958 QFile file( fileName );
1958 if (!file.open( IO_ReadOnly ) ) { 1959 if (!file.open( IO_ReadOnly ) ) {
1959 setCaption( i18n("Error open file") ); 1960 setCaption( i18n("Error open file") );
1960 delete mSyncActionDialog; 1961 delete mSyncActionDialog;
1961 mSyncActionDialog = 0; 1962 mSyncActionDialog = 0;
1962 qDebug("error open cal file "); 1963 qDebug("error open cal file ");
1963 return ; 1964 return ;
1964 1965
1965 } 1966 }
1966 setCaption( i18n("Sending file...") ); 1967 setCaption( i18n("Sending file...") );
1967 QTextStream ts( &file ); 1968 QTextStream ts( &file );
1968 ts.setCodec( QTextCodec::codecForName("utf8") ); 1969 ts.setCodec( QTextCodec::codecForName("utf8") );
1969 QTextStream os( socket ); 1970 QTextStream os( socket );
1970 os.setCodec( QTextCodec::codecForName("utf8") ); 1971 os.setCodec( QTextCodec::codecForName("utf8") );
1971 //os.setEncoding( QTextStream::UnicodeUTF8 ); 1972 //os.setEncoding( QTextStream::UnicodeUTF8 );
1972 while ( ! ts.atEnd() ) { 1973 while ( ! ts.atEnd() ) {
1973 os << ts.readLine() << "\n"; 1974 os << ts.readLine() << "\n";
1974 } 1975 }
1975 //os << ts.read(); 1976 //os << ts.read();
1976 socket->close(); 1977 socket->close();
1977 file.close(); 1978 file.close();
1978 setCaption( i18n("File sent. Waiting to get back synced file") ); 1979 setCaption( i18n("File sent. Waiting to get back synced file") );
1979 qDebug("file sent "); 1980 qDebug("file sent ");
1980} 1981}
1981void MainWindow::getFile(QSocket* socket) 1982void MainWindow::getFile(QSocket* socket)
1982{ 1983{
1983 setCaption( i18n("Receiving synced file...") ); 1984 setCaption( i18n("Receiving synced file...") );
1984 qDebug("MainWindow::sendFile(QSocket* s) ");
1985 1985
1986 QString fileName = defaultFileName(); 1986 QString fileName = defaultFileName();
1987 QFile file( fileName ); 1987 QFile file( fileName );
1988 if (!file.open( IO_WriteOnly ) ) { 1988 if (!file.open( IO_WriteOnly ) ) {
1989 setCaption( i18n("Error open file") ); 1989 setCaption( i18n("Error open file") );
1990 delete mSyncActionDialog; 1990 delete mSyncActionDialog;
1991 mSyncActionDialog = 0; 1991 mSyncActionDialog = 0;
1992 qDebug("error open cal file "); 1992 qDebug("error open cal file ");
1993 return ; 1993 return ;
1994 1994
1995 } 1995 }
1996 1996
1997 mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); 1997 mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
1998 QTextStream ts( &file ); 1998 QTextStream ts( &file );
1999 ts.setCodec( QTextCodec::codecForName("utf8") ); 1999 ts.setCodec( QTextCodec::codecForName("utf8") );
2000 bool first = true; 2000 bool first = true;
2001 while ( socket->canReadLine () || first ) { 2001 while ( socket->canReadLine () || first ) {
2002 first = false; 2002 first = false;
2003 while ( socket->canReadLine () ) { 2003 while ( socket->canReadLine () ) {
2004 ts << socket->readLine (); 2004 ts << socket->readLine ();
2005 } 2005 }
2006 socket->waitForMore ( 5000 ); 2006 socket->waitForMore ( 5000 );
2007 } 2007 }
2008 setCaption( i18n("File received - reloading calendar...") ); 2008 setCaption( i18n("File received - reloading calendar...") );
2009 file.close(); 2009 file.close();
2010 socket->close(); 2010 socket->close();
2011 mView->watchSavedFile(); 2011 mView->watchSavedFile();
2012 mView->openCalendar( defaultFileName() ); 2012 mView->openCalendar( defaultFileName() );
2013 setCaption( i18n("Easy-Pi-Sync successful!") ); 2013 setCaption( i18n("Easy-Pi-Sync successful!") );
2014 delete mSyncActionDialog; 2014 delete mSyncActionDialog;
2015 mSyncActionDialog = 0; 2015 mSyncActionDialog = 0;
2016 2016
2017 2017
2018} 2018}
2019void MainWindow::endConnect() 2019void MainWindow::endConnect()
2020{ 2020{
2021 setCaption( i18n("No file received - syncing successful") ); 2021 setCaption( i18n("No file received - syncing successful") );
2022 delete mSyncActionDialog; 2022 delete mSyncActionDialog;
2023 mSyncActionDialog = 0; 2023 mSyncActionDialog = 0;
2024} 2024}
2025void MainWindow::performQuick() 2025void MainWindow::performQuick()
2026{ 2026{
2027 setCaption( i18n("Please input connection settings") ); 2027 setCaption( i18n("Please input connection settings") );
2028 QString retfile = ""; 2028 QString retfile = "";
2029 QDialog dia ( this, "input-dialog", true ); 2029 QDialog dia ( this, "input-dialog", true );
2030 QLineEdit lab ( &dia ); 2030 QLineEdit lab ( &dia );
2031 QVBoxLayout lay( &dia ); 2031 QVBoxLayout lay( &dia );
2032 QLabel label ( i18n("IP address\n(Example: 192.168.0.40)"), &dia ); 2032 QLabel label ( i18n("IP address\n(Example: 192.168.0.40)"), &dia );
2033 lay.addWidget( &label); 2033 lay.addWidget( &label);
2034 lab.setText( KOPrefs::instance()->mActiveSyncIP ); 2034 lab.setText( KOPrefs::instance()->mActiveSyncIP );
2035 lay.setMargin(7); 2035 lay.setMargin(7);
2036 lay.setSpacing(7); 2036 lay.setSpacing(7);
2037 lay.addWidget( &lab); 2037 lay.addWidget( &lab);
2038 QLabel label2 ( i18n("Port number (Default: 9197)"), &dia ); 2038 QLabel label2 ( i18n("Port number (Default: 9197)"), &dia );
2039 lay.addWidget( &label2); 2039 lay.addWidget( &label2);
2040 QLineEdit lab2 ( &dia ); 2040 QLineEdit lab2 ( &dia );
2041 lab2.setText( KOPrefs::instance()->mActiveSyncPort ); 2041 lab2.setText( KOPrefs::instance()->mActiveSyncPort );
2042 lay.addWidget( &lab2); 2042 lay.addWidget( &lab2);
2043 dia.setFixedSize( 230,200 ); 2043 dia.setFixedSize( 230,200 );
2044 dia.setCaption( i18n("Enter port for Easy-Pi-Sync ") ); 2044 dia.setCaption( i18n("Enter port for Easy-Pi-Sync ") );
2045 QPushButton pb ( "OK", &dia); 2045 QPushButton pb ( "OK", &dia);
2046 lay.addWidget( &pb ); 2046 lay.addWidget( &pb );
2047 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 2047 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
2048 dia.show(); 2048 dia.show();
2049 int res = dia.exec(); 2049 int res = dia.exec();
2050 if ( !res ) { 2050 if ( !res ) {
2051 setCaption( i18n("Syncing cancelled!") ); 2051 setCaption( i18n("Syncing cancelled!") );
2052 return; 2052 return;
2053 } 2053 }
2054 dia.hide(); 2054 dia.hide();
2055 KOPrefs::instance()->mActiveSyncPort = lab2.text(); 2055 KOPrefs::instance()->mActiveSyncPort = lab2.text();
2056 KOPrefs::instance()->mActiveSyncIP = lab.text(); 2056 KOPrefs::instance()->mActiveSyncIP = lab.text();
2057 qApp->processEvents(); 2057 qApp->processEvents();
2058 performQuickQuick(); 2058 performQuickQuick();
2059} 2059}
2060 2060
2061void MainWindow::performQuickQuick() 2061void MainWindow::performQuickQuick()
2062{ 2062{
2063 // setCaption( i18n("") ); 2063 // setCaption( i18n("") );
2064 2064
2065 bool ok; 2065 bool ok;
2066 Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok); 2066 Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok);
2067 if ( ! ok ) { 2067 if ( ! ok ) {
2068 setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); 2068 setCaption( i18n("Sorry, no valid port.Syncing cancelled.") );
2069 return; 2069 return;
2070 } 2070 }
2071 if ( mCommandSocket ) 2071 if ( !mCommandSocket ) {
2072 delete mCommandSocket; 2072 mCommandSocket = new QSocket( this );
2073 mCommandSocket = new QSocket( this ); 2073 // delete mCommandSocket;
2074 connect( mCommandSocket, SIGNAL(readyRead()), this, SLOT(readFileFromSocket()) ); 2074 //mCommandSocket = new QSocket( this );
2075 connect( mCommandSocket, SIGNAL(readyRead()), this, SLOT(readFileFromSocket()) );
2076 }
2075 QString host = KOPrefs::instance()->mActiveSyncIP; 2077 QString host = KOPrefs::instance()->mActiveSyncIP;
2076 mCommandSocket->connectToHost( host, port ); 2078 mCommandSocket->connectToHost( host, port );
2077 QTextStream os( mCommandSocket ); 2079 QTextStream os( mCommandSocket );
2078 os.setEncoding( QTextStream::UnicodeUTF8 ); 2080 os.setEncoding( QTextStream::UnicodeUTF8 );
2079 os << "GET\r\n"; 2081 os << "GET\r\n";
2080 setCaption( i18n("Sending request for remote file ...") ); 2082 setCaption( i18n("Sending request for remote file ...") );
2081 2083
2082} 2084}
2083void MainWindow::readFileFromSocket() 2085void MainWindow::readFileFromSocket()
2084{ 2086{
2085 setCaption( i18n("Receiving remote file ...") ); 2087 setCaption( i18n("Receiving remote file ...") );
2086 qDebug("MainWindow::readFileFromSocket() "); 2088 qDebug("MainWindow::readFileFromSocket() ");
2087QString fileName; 2089QString fileName;
2088#ifdef _WIN32_ 2090#ifdef _WIN32_
2089 fileName = defaultFileName() +"sync"; 2091 fileName = defaultFileName() +"sync";
2090#else 2092#else
2091 fileName = "/tmp/kopitempfile.ics"; 2093 fileName = "/tmp/kopitempfile.ics";
2092#endif 2094#endif
2093 QFile file( fileName ); 2095 QFile file( fileName );
2094 if (!file.open( IO_WriteOnly ) ) { 2096 if (!file.open( IO_WriteOnly ) ) {
2095 setCaption( i18n("Error: Cannot open temp file for write.") ); 2097 setCaption( i18n("Error: Cannot open temp file for write.") );
2096 qDebug("Error open calender file for writing: %s",fileName.latin1() ); 2098 qDebug("Error open calender file for writing: %s",fileName.latin1() );
2097 return ; 2099 return ;
2098 } 2100 }
2099 2101
2100 //QTextStream os2( mCommandSocket ); 2102 //QTextStream os2( mCommandSocket );
2101 //os2.setEncoding( QTextStream::UnicodeUTF8 ); 2103 //os2.setEncoding( QTextStream::UnicodeUTF8 );
2102 2104
2103 QTextStream ts( &file ); 2105 QTextStream ts( &file );
2104 ts.setCodec( QTextCodec::codecForName("utf8") ); 2106 ts.setCodec( QTextCodec::codecForName("utf8") );
2105 bool first = true; 2107 bool first = true;
2106 while ( mCommandSocket->canReadLine () || first) { 2108 while ( mCommandSocket->canReadLine () || first) {
2107 first = false; 2109 first = false;
2108 while ( mCommandSocket->canReadLine () ) { 2110 while ( mCommandSocket->canReadLine () ) {
2109 ts << mCommandSocket->readLine (); 2111 ts << mCommandSocket->readLine ();
2110 } 2112 }
2111 mCommandSocket->waitForMore ( 5000 ); 2113 mCommandSocket->waitForMore ( 5000 );
2112 } 2114 }
2113 file.close(); 2115 file.close();
2114 mCommandSocket->close(); 2116 mCommandSocket->close();
2115 delete mCommandSocket; 2117 //delete mCommandSocket;
2116 setCaption( i18n("Remote file saved to temp file.") ); 2118 setCaption( i18n("Remote file saved to temp file.") );
2117 mCommandSocket = 0; 2119 //mCommandSocket = 0;
2118 mCurrentSyncProfile = 2 ; // last file 2120 mCurrentSyncProfile = 2 ; // last file
2119 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); 2121 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
2120 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 2122 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
2121 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 2123 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
2122 KSyncProfile* temp = new KSyncProfile (); 2124 KSyncProfile* temp = new KSyncProfile ();
2123 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 2125 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
2124 temp->readConfig(&config); 2126 temp->readConfig(&config);
2125 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 2127 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
2126 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); 2128 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
2127 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 2129 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
2128 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 2130 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
2129 KOPrefs::instance()->mWriteBackInFuture = 0; 2131 KOPrefs::instance()->mWriteBackInFuture = 0;
2130 if ( temp->getWriteBackFuture() ) 2132 if ( temp->getWriteBackFuture() )
2131 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 2133 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
2132 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); 2134 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
2133 2135
2134 setCaption( i18n("Remote file saved to temp file.") ); 2136 setCaption( i18n("Remote file saved to temp file.") );
2135 if ( ! syncWithFile( fileName , true ) ) { 2137 if ( ! syncWithFile( fileName , true ) ) {
2136 setCaption( i18n("Syncing failed.") ); 2138 setCaption( i18n("Syncing failed.") );
2137 qDebug("Syncing failed "); 2139 qDebug("Syncing failed ");
2138 return; 2140 return;
2139 } 2141 }
2140 2142
2141 mCommandSocket = new QSocket( this ); 2143 if ( !mCommandSocketFinish ) {
2142 QString host = KOPrefs::instance()->mActiveSyncIP; 2144 mCommandSocketFinish = new QSocket( this );
2143 mCommandSocket->connectToHost( KOPrefs::instance()->mActiveSyncIP, KOPrefs::instance()->mActiveSyncPort.toUInt() ); 2145 }
2146 mCommandSocketFinish->connectToHost( KOPrefs::instance()->mActiveSyncIP, KOPrefs::instance()->mActiveSyncPort.toUInt() );
2144 2147
2148 QString host = KOPrefs::instance()->mActiveSyncIP;
2145 QFile file2( fileName ); 2149 QFile file2( fileName );
2146 if (!file2.open( IO_ReadOnly ) ) { 2150 if (!file2.open( IO_ReadOnly ) ) {
2147 setCaption( i18n("Error: Cannot open temp file for read.") ); 2151 setCaption( i18n("Error: Cannot open temp file for read.") );
2148 qDebug("error open cal file "); 2152 qDebug("error open cal file ");
2149 return ; 2153 return ;
2150 2154
2151 } 2155 }
2152 setCaption( i18n("Sending back synced file...") ); 2156 setCaption( i18n("Sending back synced file...") );
2153 QTextStream ts2( &file2 ); 2157 QTextStream ts2( &file2 );
2154 ts2.setCodec( QTextCodec::codecForName("utf8") ); 2158 ts2.setCodec( QTextCodec::codecForName("utf8") );
2155 QTextStream os2( mCommandSocket ); 2159 QTextStream os2( mCommandSocketFinish );
2156 os2.setCodec( QTextCodec::codecForName("utf8") ); 2160 os2.setCodec( QTextCodec::codecForName("utf8") );
2157 //os.setEncoding( QTextStream::UnicodeUTF8 ); 2161 //os.setEncoding( QTextStream::UnicodeUTF8 );
2158 if ( KOPrefs::instance()->mWriteBackFile ) { 2162 if ( KOPrefs::instance()->mWriteBackFile ) {
2159 os2 << "PUT\r\n"; 2163 os2 << "PUT\r\n";
2160 while ( ! ts2.atEnd() ) { 2164 while ( ! ts2.atEnd() ) {
2161 os2 << ts2.readLine() << "\n"; 2165 os2 << ts2.readLine() << "\n";
2162 } 2166 }
2163 } else { 2167 } else {
2164 os2 << "STOP\r\n"; 2168 os2 << "STOP\r\n";
2165 } 2169 }
2166 mCommandSocket->close(); 2170 mCommandSocketFinish->close();
2167 file.close(); 2171 file.close();
2168 delete mCommandSocket; 2172 //delete ( mCommandSocket);
2169 mCommandSocket = 0; 2173 //mCommandSocket = 0;
2170 qDebug("Syncing succesful! "); 2174 qDebug("Syncing succesful! ");
2171 setCaption( i18n("Easy-Pi-Sync succesful!") ); 2175 setCaption( i18n("Easy-Pi-Sync succesful!") );
2172 2176
2173 2177
2174} 2178}
2175 2179
2176void MainWindow::syncLocalFile() 2180void MainWindow::syncLocalFile()
2177{ 2181{
2178 2182
2179 QString fn =KOPrefs::instance()->mLastSyncedLocalFile; 2183 QString fn =KOPrefs::instance()->mLastSyncedLocalFile;
2180 2184
2181 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 2185 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
2182 if ( fn == "" ) 2186 if ( fn == "" )
2183 return; 2187 return;
2184 //mView->setSyncDevice("local-file" ); 2188 //mView->setSyncDevice("local-file" );
2185 if ( syncWithFile( fn, false ) ) { 2189 if ( syncWithFile( fn, false ) ) {
2186 // Event* e = mView->getLastSyncEvent(); 2190 // Event* e = mView->getLastSyncEvent();
2187// e->setReadOnly( false ); 2191// e->setReadOnly( false );
2188// e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); 2192// e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
2189// e->setReadOnly( true ); 2193// e->setReadOnly( true );
2190 } 2194 }
2191 2195
2192} 2196}
2193 2197
2194bool MainWindow::syncWithFile( QString fn , bool quick ) 2198bool MainWindow::syncWithFile( QString fn , bool quick )
2195{ 2199{
2196 bool ret = false; 2200 bool ret = false;
2197 QFileInfo info; 2201 QFileInfo info;
2198 info.setFile( fn ); 2202 info.setFile( fn );
2199 QString mess; 2203 QString mess;
2200 bool loadbup = true; 2204 bool loadbup = true;
2201 if ( !info. exists() ) { 2205 if ( !info. exists() ) {
2202 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); 2206 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
2203 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2207 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2204 mess ); 2208 mess );
2205 return ret; 2209 return ret;
2206 } 2210 }
2207 int result = 0; 2211 int result = 0;
2208 if ( !quick ) { 2212 if ( !quick ) {
2209 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2213 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2210 result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2214 result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2211 mess, 2215 mess,
2212 i18n("Sync"), i18n("Cancel"), 0, 2216 i18n("Sync"), i18n("Cancel"), 0,
2213 0, 1 ); 2217 0, 1 );
2214 if ( result ) 2218 if ( result )
2215 return false; 2219 return false;
2216 } 2220 }
2217 if ( KOPrefs::instance()->mAskForPreferences ) 2221 if ( KOPrefs::instance()->mAskForPreferences )
2218 mView->edit_sync_options(); 2222 mView->edit_sync_options();
2219 if ( result == 0 ) { 2223 if ( result == 0 ) {
2220 //qDebug("Now sycing ... "); 2224 //qDebug("Now sycing ... ");
2221 if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) 2225 if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) )
2222 setCaption( i18n("Synchronization successful") ); 2226 setCaption( i18n("Synchronization successful") );
2223 else 2227 else
2224 setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); 2228 setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
2225 if ( ! quick ) 2229 if ( ! quick )
2226 KOPrefs::instance()->mLastSyncedLocalFile = fn; 2230 KOPrefs::instance()->mLastSyncedLocalFile = fn;
2227 slotModifiedChanged( true ); 2231 slotModifiedChanged( true );
2228 } 2232 }
2229 return ret; 2233 return ret;
2230} 2234}
2231void MainWindow::quickSyncLocalFile() 2235void MainWindow::quickSyncLocalFile()
2232{ 2236{
2233 //mView->setSyncDevice("local-file" ); 2237 //mView->setSyncDevice("local-file" );
2234 //qDebug("quickSyncLocalFile() "); 2238 //qDebug("quickSyncLocalFile() ");
2235 if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { 2239 if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) {
2236 // Event* e = mView->getLastSyncEvent(); 2240 // Event* e = mView->getLastSyncEvent();
2237// e->setReadOnly( false ); 2241// e->setReadOnly( false );
2238// e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); 2242// e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
2239// e->setReadOnly( true ); 2243// e->setReadOnly( true );
2240 2244
2241 } 2245 }
2242} 2246}
2243 2247
2244void MainWindow::confSync() 2248void MainWindow::confSync()
2245{ 2249{
2246 mView->confSync(); 2250 mView->confSync();
2247 fillSyncMenu(); 2251 fillSyncMenu();
2248} 2252}
2249void MainWindow::syncRemote( KSyncProfile* prof, bool ask) 2253void MainWindow::syncRemote( KSyncProfile* prof, bool ask)
2250{ 2254{
2251 QString question; 2255 QString question;
2252 if ( ask ) { 2256 if ( ask ) {
2253 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; 2257 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n";
2254 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 2258 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
2255 question, 2259 question,
2256 i18n("Yes"), i18n("No"), 2260 i18n("Yes"), i18n("No"),
2257 0, 0 ) != 0 ) 2261 0, 0 ) != 0 )
2258 return; 2262 return;
2259 } 2263 }
2260 QString command = prof->getPreSyncCommand(); 2264 QString command = prof->getPreSyncCommand();
2261 int fi; 2265 int fi;
2262 if ( (fi = command.find("$PWD$")) > 0 ) { 2266 if ( (fi = command.find("$PWD$")) > 0 ) {
2263 QString pwd = getPassword(); 2267 QString pwd = getPassword();
2264 command = command.left( fi )+ pwd + command.mid( fi+5 ); 2268 command = command.left( fi )+ pwd + command.mid( fi+5 );
2265 2269
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 9bb2302..5985d56 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -54,133 +54,134 @@ private slots:
54 qDebug("readClient() "); 54 qDebug("readClient() ");
55 QSocket* socket = (QSocket*)sender(); 55 QSocket* socket = (QSocket*)sender();
56 if ( socket->canReadLine() ) { 56 if ( socket->canReadLine() ) {
57 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), socket->readLine() ); 57 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), socket->readLine() );
58 if ( tokens[0] == "GET" ) { 58 if ( tokens[0] == "GET" ) {
59 emit sendFile( socket ); 59 emit sendFile( socket );
60 } 60 }
61 if ( tokens[0] == "PUT" ) { 61 if ( tokens[0] == "PUT" ) {
62 emit getFile( socket ); 62 emit getFile( socket );
63 } 63 }
64 if ( tokens[0] == "STOP" ) { 64 if ( tokens[0] == "STOP" ) {
65 emit endConnect(); 65 emit endConnect();
66 } 66 }
67 } 67 }
68 } 68 }
69}; 69};
70 70
71 71
72namespace KCal { 72namespace KCal {
73class CalendarLocal; 73class CalendarLocal;
74} 74}
75 75
76using namespace KCal; 76using namespace KCal;
77 77
78class MainWindow : public QMainWindow 78class MainWindow : public QMainWindow
79{ 79{
80 Q_OBJECT 80 Q_OBJECT
81 public: 81 public:
82 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 82 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
83 ~MainWindow(); 83 ~MainWindow();
84 public slots: 84 public slots:
85 virtual void showMaximized (); 85 virtual void showMaximized ();
86 void configureAgenda( int ); 86 void configureAgenda( int );
87 void recieve( const QCString& msg, const QByteArray& data ); 87 void recieve( const QCString& msg, const QByteArray& data );
88 static QString defaultFileName(); 88 static QString defaultFileName();
89 static QString resourcePath(); 89 static QString resourcePath();
90 protected slots: 90 protected slots:
91 void setCaptionToDates(); 91 void setCaptionToDates();
92 int ringSync(); 92 int ringSync();
93 void multiSync( bool askforPrefs = false ); 93 void multiSync( bool askforPrefs = false );
94 void about(); 94 void about();
95 void licence(); 95 void licence();
96 void faq(); 96 void faq();
97 void usertrans(); 97 void usertrans();
98 void features(); 98 void features();
99 void synchowto(); 99 void synchowto();
100 void whatsNew(); 100 void whatsNew();
101 void keyBindings(); 101 void keyBindings();
102 void aboutAutoSaving();; 102 void aboutAutoSaving();;
103 void aboutKnownBugs(); 103 void aboutKnownBugs();
104 104
105 void processIncidenceSelection( Incidence * ); 105 void processIncidenceSelection( Incidence * );
106 106
107 void importQtopia(); 107 void importQtopia();
108 void importBday(); 108 void importBday();
109 void importOL(); 109 void importOL();
110 void importIcal(); 110 void importIcal();
111 void importFile( QString, bool ); 111 void importFile( QString, bool );
112 void quickImportIcal(); 112 void quickImportIcal();
113 113
114 void slotModifiedChanged( bool ); 114 void slotModifiedChanged( bool );
115 115
116 void save(); 116 void save();
117 void configureToolBar( int ); 117 void configureToolBar( int );
118 void printSel(); 118 void printSel();
119 void printCal(); 119 void printCal();
120 void saveCalendar(); 120 void saveCalendar();
121 void loadCalendar(); 121 void loadCalendar();
122 void exportVCalendar(); 122 void exportVCalendar();
123 void fillFilterMenu(); 123 void fillFilterMenu();
124 void selectFilter( int ); 124 void selectFilter( int );
125 125
126 void slotSyncMenu( int ); 126 void slotSyncMenu( int );
127 void syncSSH(); 127 void syncSSH();
128 void confSync(); 128 void confSync();
129 void syncSharp(); 129 void syncSharp();
130 void syncPhone(); 130 void syncPhone();
131 void syncLocalFile(); 131 void syncLocalFile();
132 bool syncWithFile( QString, bool ); 132 bool syncWithFile( QString, bool );
133 void quickSyncLocalFile(); 133 void quickSyncLocalFile();
134 134
135 135
136 protected: 136 protected:
137 void displayText( QString, QString); 137 void displayText( QString, QString);
138 void displayFile( QString, QString); 138 void displayFile( QString, QString);
139 139
140 void enableIncidenceActions( bool ); 140 void enableIncidenceActions( bool );
141 141
142 private slots: 142 private slots:
143 void fillSyncMenu(); 143 void fillSyncMenu();
144 void sendFile(QSocket* s); 144 void sendFile(QSocket* s);
145 void getFile(QSocket* socket); 145 void getFile(QSocket* socket);
146 void readFileFromSocket(); 146 void readFileFromSocket();
147 void endConnect(); 147 void endConnect();
148 private: 148 private:
149 QSocket* mCommandSocket; 149 QSocket* mCommandSocket;
150 QSocket* mCommandSocketFinish;
150 KServerSocket * mServerSocket; 151 KServerSocket * mServerSocket;
151 bool mClosed; 152 bool mClosed;
152 void saveOnClose(); 153 void saveOnClose();
153 int mCurrentSyncProfile; 154 int mCurrentSyncProfile;
154 void enableQuick(); 155 void enableQuick();
155 void performQuick(); 156 void performQuick();
156 void performQuickQuick(); 157 void performQuickQuick();
157 void syncRemote( KSyncProfile* , bool ask = true); 158 void syncRemote( KSyncProfile* , bool ask = true);
158 bool mFlagKeyPressed; 159 bool mFlagKeyPressed;
159 bool mBlockAtStartup; 160 bool mBlockAtStartup;
160 QPEToolBar *iconToolBar; 161 QPEToolBar *iconToolBar;
161 void initActions(); 162 void initActions();
162 void setDefaultPreferences(); 163 void setDefaultPreferences();
163 void keyPressEvent ( QKeyEvent * ) ; 164 void keyPressEvent ( QKeyEvent * ) ;
164 void keyReleaseEvent ( QKeyEvent * ) ; 165 void keyReleaseEvent ( QKeyEvent * ) ;
165 QPopupMenu *configureToolBarMenu; 166 QPopupMenu *configureToolBarMenu;
166 QPopupMenu *selectFilterMenu; 167 QPopupMenu *selectFilterMenu;
167 QPopupMenu *configureAgendaMenu, *syncMenu; 168 QPopupMenu *configureAgendaMenu, *syncMenu;
168 CalendarLocal *mCalendar; 169 CalendarLocal *mCalendar;
169 CalendarView *mView; 170 CalendarView *mView;
170 QString getPassword(); 171 QString getPassword();
171 QAction *mNewSubTodoAction; 172 QAction *mNewSubTodoAction;
172 173
173 QAction *mShowAction; 174 QAction *mShowAction;
174 QAction *mEditAction; 175 QAction *mEditAction;
175 QAction *mDeleteAction; 176 QAction *mDeleteAction;
176 void closeEvent( QCloseEvent* ce ); 177 void closeEvent( QCloseEvent* ce );
177 SimpleAlarmClient mAlarmClient; 178 SimpleAlarmClient mAlarmClient;
178 QTimer mSaveTimer; 179 QTimer mSaveTimer;
179 bool mBlockSaveFlag; 180 bool mBlockSaveFlag;
180 bool mCalendarModifiedFlag; 181 bool mCalendarModifiedFlag;
181 QPixmap loadPixmap( QString ); 182 QPixmap loadPixmap( QString );
182 QDialog * mSyncActionDialog; 183 QDialog * mSyncActionDialog;
183}; 184};
184 185
185 186
186#endif 187#endif