summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.h
Side-by-side diff
Diffstat (limited to 'korganizer/mainwindow.h') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.h65
1 files changed, 64 insertions, 1 deletions
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 47a7a90..58081f6 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -4,6 +4,7 @@
#include <qmainwindow.h>
#include <qtimer.h>
#include <qdict.h>
+#include <qregexp.h>
#include <libkcal/incidence.h>
#include "simplealarmclient.h"
@@ -17,6 +18,56 @@ class KSyncProfile;
#define QPEMenuBar QMenuBar
#endif
class QPEToolBar;
+#include <qserversocket.h>
+#include <qsocket.h>
+#include <qnetworkprotocol.h>
+
+class KServerSocket : public QServerSocket
+{
+ Q_OBJECT
+
+public:
+ KServerSocket ( Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ) :
+ QServerSocket( port, backlog, parent, name ){;};
+ void newConnection ( int socket )
+ {
+ qDebug("KServerSocket:New connection %d ", socket);
+ QSocket* s = new QSocket( this );
+ connect( s, SIGNAL(readyRead()), this, SLOT(readClient()) );
+ connect( s, SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
+ s->setSocket( socket );
+ }
+
+signals:
+ void sendFile(QSocket*);
+ void getFile(QSocket*);
+ void endConnect();
+private slots:
+ void discardClient()
+ {
+ QSocket* socket = (QSocket*)sender();
+ delete socket;
+ emit endConnect();
+ }
+ void readClient()
+ {
+ qDebug("readClient() ");
+ QSocket* socket = (QSocket*)sender();
+ if ( socket->canReadLine() ) {
+ QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), socket->readLine() );
+ if ( tokens[0] == "GET" ) {
+ emit sendFile( socket );
+ }
+ if ( tokens[0] == "PUT" ) {
+ emit getFile( socket );
+ }
+ if ( tokens[0] == "STOP" ) {
+ emit endConnect();
+ }
+ }
+ }
+};
+
namespace KCal {
class CalendarLocal;
@@ -88,12 +139,22 @@ class MainWindow : public QMainWindow
void enableIncidenceActions( bool );
+ private slots:
+ void fillSyncMenu();
+ void sendFile(QSocket* s);
+ void getFile(QSocket* socket);
+ void readFileFromSocket();
+ void endConnect();
private:
+ QSocket* mCommandSocket;
+ KServerSocket * mServerSocket;
bool mClosed;
void saveOnClose();
int mCurrentSyncProfile;
+ void enableQuick();
+ void performQuick();
+ void performQuickQuick();
void syncRemote( KSyncProfile* , bool ask = true);
- void fillSyncMenu();
bool mFlagKeyPressed;
bool mBlockAtStartup;
QPEToolBar *iconToolBar;
@@ -118,6 +179,8 @@ class MainWindow : public QMainWindow
bool mBlockSaveFlag;
bool mCalendarModifiedFlag;
QPixmap loadPixmap( QString );
+ QDialog * mSyncActionDialog;
};
+
#endif