summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.h
Unidiff
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 @@
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qregexp.h>
7 8
8#include <libkcal/incidence.h> 9#include <libkcal/incidence.h>
9#include "simplealarmclient.h" 10#include "simplealarmclient.h"
@@ -17,6 +18,56 @@ class KSyncProfile;
17#define QPEMenuBar QMenuBar 18#define QPEMenuBar QMenuBar
18#endif 19#endif
19class QPEToolBar; 20class QPEToolBar;
21#include <qserversocket.h>
22#include <qsocket.h>
23#include <qnetworkprotocol.h>
24
25class KServerSocket : public QServerSocket
26{
27 Q_OBJECT
28
29public:
30 KServerSocket ( Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ) :
31 QServerSocket( port, backlog, parent, name ){;};
32 void newConnection ( int socket )
33 {
34 qDebug("KServerSocket:New connection %d ", socket);
35 QSocket* s = new QSocket( this );
36 connect( s, SIGNAL(readyRead()), this, SLOT(readClient()) );
37 connect( s, SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
38 s->setSocket( socket );
39 }
40
41signals:
42 void sendFile(QSocket*);
43 void getFile(QSocket*);
44 void endConnect();
45private slots:
46 void discardClient()
47 {
48 QSocket* socket = (QSocket*)sender();
49 delete socket;
50 emit endConnect();
51 }
52 void readClient()
53 {
54 qDebug("readClient() ");
55 QSocket* socket = (QSocket*)sender();
56 if ( socket->canReadLine() ) {
57 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), socket->readLine() );
58 if ( tokens[0] == "GET" ) {
59 emit sendFile( socket );
60 }
61 if ( tokens[0] == "PUT" ) {
62 emit getFile( socket );
63 }
64 if ( tokens[0] == "STOP" ) {
65 emit endConnect();
66 }
67 }
68 }
69};
70
20 71
21namespace KCal { 72namespace KCal {
22class CalendarLocal; 73class CalendarLocal;
@@ -88,12 +139,22 @@ class MainWindow : public QMainWindow
88 139
89 void enableIncidenceActions( bool ); 140 void enableIncidenceActions( bool );
90 141
142 private slots:
143 void fillSyncMenu();
144 void sendFile(QSocket* s);
145 void getFile(QSocket* socket);
146 void readFileFromSocket();
147 void endConnect();
91 private: 148 private:
149 QSocket* mCommandSocket;
150 KServerSocket * mServerSocket;
92 bool mClosed; 151 bool mClosed;
93 void saveOnClose(); 152 void saveOnClose();
94 int mCurrentSyncProfile; 153 int mCurrentSyncProfile;
154 void enableQuick();
155 void performQuick();
156 void performQuickQuick();
95 void syncRemote( KSyncProfile* , bool ask = true); 157 void syncRemote( KSyncProfile* , bool ask = true);
96 void fillSyncMenu();
97 bool mFlagKeyPressed; 158 bool mFlagKeyPressed;
98 bool mBlockAtStartup; 159 bool mBlockAtStartup;
99 QPEToolBar *iconToolBar; 160 QPEToolBar *iconToolBar;
@@ -118,6 +179,8 @@ class MainWindow : public QMainWindow
118 bool mBlockSaveFlag; 179 bool mBlockSaveFlag;
119 bool mCalendarModifiedFlag; 180 bool mCalendarModifiedFlag;
120 QPixmap loadPixmap( QString ); 181 QPixmap loadPixmap( QString );
182 QDialog * mSyncActionDialog;
121}; 183};
122 184
185
123#endif 186#endif