summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp2
-rw-r--r--korganizer/mainwindow.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index f2e1bf8..ebe761a 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1894,96 +1894,98 @@ QString MainWindow::getPassword( )
1894void MainWindow::enableQuick() 1894void MainWindow::enableQuick()
1895{ 1895{
1896 QString retfile = ""; 1896 QString retfile = "";
1897 QDialog dia ( this, "input-dialog", true ); 1897 QDialog dia ( this, "input-dialog", true );
1898 QLineEdit lab ( &dia ); 1898 QLineEdit lab ( &dia );
1899 QVBoxLayout lay( &dia ); 1899 QVBoxLayout lay( &dia );
1900 lab.setText( KOPrefs::instance()->mPassiveSyncPort ); 1900 lab.setText( KOPrefs::instance()->mPassiveSyncPort );
1901 lay.setMargin(7); 1901 lay.setMargin(7);
1902 lay.setSpacing(7); 1902 lay.setSpacing(7);
1903 QLabel label ( i18n("Port number (Default: 9197)"), &dia ); 1903 QLabel label ( i18n("Port number (Default: 9197)"), &dia );
1904 lay.addWidget( &label); 1904 lay.addWidget( &label);
1905 lay.addWidget( &lab); 1905 lay.addWidget( &lab);
1906 dia.setFixedSize( 230,80 ); 1906 dia.setFixedSize( 230,80 );
1907 dia.setCaption( i18n("Enter port for Easy-Pi-Sync") ); 1907 dia.setCaption( i18n("Enter port for Easy-Pi-Sync") );
1908 QPushButton pb ( "OK", &dia); 1908 QPushButton pb ( "OK", &dia);
1909 lay.addWidget( &pb ); 1909 lay.addWidget( &pb );
1910 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 1910 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
1911 dia.show(); 1911 dia.show();
1912 int res = dia.exec(); 1912 int res = dia.exec();
1913 if ( res ) 1913 if ( res )
1914 retfile = lab.text(); 1914 retfile = lab.text();
1915 else 1915 else
1916 return; 1916 return;
1917 dia.hide(); 1917 dia.hide();
1918 qApp->processEvents(); 1918 qApp->processEvents();
1919 KOPrefs::instance()->mPassiveSyncPort = retfile; 1919 KOPrefs::instance()->mPassiveSyncPort = retfile;
1920 bool ok; 1920 bool ok;
1921 Q_UINT16 port = retfile.toUInt(&ok); 1921 Q_UINT16 port = retfile.toUInt(&ok);
1922 if ( ! ok ) { 1922 if ( ! ok ) {
1923 qDebug("no valid port "); 1923 qDebug("no valid port ");
1924 return; 1924 return;
1925 } 1925 }
1926 qDebug("port %d ", port); 1926 qDebug("port %d ", port);
1927 mServerSocket = new KServerSocket ( port ,1 ); 1927 mServerSocket = new KServerSocket ( port ,1 );
1928 qDebug("connected "); 1928 qDebug("connected ");
1929 if ( !mServerSocket->ok() ) { 1929 if ( !mServerSocket->ok() ) {
1930 qWarning("Failed to bind to port %d", port); 1930 qWarning("Failed to bind to port %d", port);
1931 delete mServerSocket; 1931 delete mServerSocket;
1932 mServerSocket = 0; 1932 mServerSocket = 0;
1933 return; 1933 return;
1934 } 1934 }
1935 connect( mServerSocket, SIGNAL ( sendFile(QSocket*) ), this, SLOT ( sendFile(QSocket*) ) ); 1935 connect( mServerSocket, SIGNAL ( sendFile(QSocket*) ), this, SLOT ( sendFile(QSocket*) ) );
1936 connect( mServerSocket, SIGNAL ( getFile(QSocket*) ), this, SLOT ( getFile(QSocket*) ) ); 1936 connect( mServerSocket, SIGNAL ( getFile(QSocket*) ), this, SLOT ( getFile(QSocket*) ) );
1937} 1937}
1938void MainWindow::sendFile(QSocket* socket) 1938void MainWindow::sendFile(QSocket* socket)
1939{ 1939{
1940 setCaption( i18n("Received request for file") ); 1940 setCaption( i18n("Received request for file") );
1941 qDebug("MainWindow::sendFile(QSocket* s) "); 1941 qDebug("MainWindow::sendFile(QSocket* s) ");
1942 if ( mSyncActionDialog )
1943 delete mSyncActionDialog;
1942 mSyncActionDialog = new QDialog ( this, "input-dialog", true ); 1944 mSyncActionDialog = new QDialog ( this, "input-dialog", true );
1943 mSyncActionDialog->setCaption(i18n("KO/Pi - WARNING")); 1945 mSyncActionDialog->setCaption(i18n("KO/Pi - WARNING"));
1944 QLabel* label = new QLabel( i18n("Synchronizing...\nDo not use\nthis application!\n"), mSyncActionDialog ); 1946 QLabel* label = new QLabel( i18n("Synchronizing...\nDo not use\nthis application!\n"), mSyncActionDialog );
1945 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); 1947 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog );
1946 lay->addWidget( label); 1948 lay->addWidget( label);
1947 lay->setMargin(7); 1949 lay->setMargin(7);
1948 lay->setSpacing(7); 1950 lay->setSpacing(7);
1949 mSyncActionDialog->setFixedSize( 200,100 ); 1951 mSyncActionDialog->setFixedSize( 200,100 );
1950 mSyncActionDialog->show(); 1952 mSyncActionDialog->show();
1951 qApp->processEvents(); 1953 qApp->processEvents();
1952 qDebug("saving ... "); 1954 qDebug("saving ... ");
1953 save(); 1955 save();
1954 QString fileName = defaultFileName(); 1956 QString fileName = defaultFileName();
1955 QFile file( fileName ); 1957 QFile file( fileName );
1956 if (!file.open( IO_ReadOnly ) ) { 1958 if (!file.open( IO_ReadOnly ) ) {
1957 setCaption( i18n("Error open file") ); 1959 setCaption( i18n("Error open file") );
1958 delete mSyncActionDialog; 1960 delete mSyncActionDialog;
1959 mSyncActionDialog = 0; 1961 mSyncActionDialog = 0;
1960 qDebug("error open cal file "); 1962 qDebug("error open cal file ");
1961 return ; 1963 return ;
1962 1964
1963 } 1965 }
1964 setCaption( i18n("Sending file...") ); 1966 setCaption( i18n("Sending file...") );
1965 QTextStream ts( &file ); 1967 QTextStream ts( &file );
1966 ts.setCodec( QTextCodec::codecForName("utf8") ); 1968 ts.setCodec( QTextCodec::codecForName("utf8") );
1967 QTextStream os( socket ); 1969 QTextStream os( socket );
1968 os.setCodec( QTextCodec::codecForName("utf8") ); 1970 os.setCodec( QTextCodec::codecForName("utf8") );
1969 //os.setEncoding( QTextStream::UnicodeUTF8 ); 1971 //os.setEncoding( QTextStream::UnicodeUTF8 );
1970 while ( ! ts.atEnd() ) { 1972 while ( ! ts.atEnd() ) {
1971 os << ts.readLine() << "\n"; 1973 os << ts.readLine() << "\n";
1972 } 1974 }
1973 //os << ts.read(); 1975 //os << ts.read();
1974 socket->close(); 1976 socket->close();
1975 file.close(); 1977 file.close();
1976 setCaption( i18n("File sent. Waiting to get back synced file") ); 1978 setCaption( i18n("File sent. Waiting to get back synced file") );
1977 qDebug("file sent "); 1979 qDebug("file sent ");
1978} 1980}
1979void MainWindow::getFile(QSocket* socket) 1981void MainWindow::getFile(QSocket* socket)
1980{ 1982{
1981 setCaption( i18n("Receiving synced file...") ); 1983 setCaption( i18n("Receiving synced file...") );
1982 qDebug("MainWindow::sendFile(QSocket* s) "); 1984 qDebug("MainWindow::sendFile(QSocket* s) ");
1983 1985
1984 QString fileName = defaultFileName(); 1986 QString fileName = defaultFileName();
1985 QFile file( fileName ); 1987 QFile file( fileName );
1986 if (!file.open( IO_WriteOnly ) ) { 1988 if (!file.open( IO_WriteOnly ) ) {
1987 setCaption( i18n("Error open file") ); 1989 setCaption( i18n("Error open file") );
1988 delete mSyncActionDialog; 1990 delete mSyncActionDialog;
1989 mSyncActionDialog = 0; 1991 mSyncActionDialog = 0;
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 58081f6..9bb2302 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -2,97 +2,97 @@
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
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#include <qregexp.h>
8 8
9#include <libkcal/incidence.h> 9#include <libkcal/incidence.h>
10#include "simplealarmclient.h" 10#include "simplealarmclient.h"
11 11
12class QAction; 12class QAction;
13class CalendarView; 13class CalendarView;
14class KSyncProfile; 14class KSyncProfile;
15#ifdef DESKTOP_VERSION 15#ifdef DESKTOP_VERSION
16 16
17#define QPEToolBar QToolBar 17#define QPEToolBar QToolBar
18#define QPEMenuBar QMenuBar 18#define QPEMenuBar QMenuBar
19#endif 19#endif
20class QPEToolBar; 20class QPEToolBar;
21#include <qserversocket.h> 21#include <qserversocket.h>
22#include <qsocket.h> 22#include <qsocket.h>
23#include <qnetworkprotocol.h> 23#include <qnetworkprotocol.h>
24 24
25class KServerSocket : public QServerSocket 25class KServerSocket : public QServerSocket
26{ 26{
27 Q_OBJECT 27 Q_OBJECT
28 28
29public: 29public:
30 KServerSocket ( Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ) : 30 KServerSocket ( Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ) :
31 QServerSocket( port, backlog, parent, name ){;}; 31 QServerSocket( port, backlog, parent, name ){;};
32 void newConnection ( int socket ) 32 void newConnection ( int socket )
33 { 33 {
34 qDebug("KServerSocket:New connection %d ", socket); 34 qDebug("KServerSocket:New connection %d ", socket);
35 QSocket* s = new QSocket( this ); 35 QSocket* s = new QSocket( this );
36 connect( s, SIGNAL(readyRead()), this, SLOT(readClient()) ); 36 connect( s, SIGNAL(readyRead()), this, SLOT(readClient()) );
37 connect( s, SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); 37 connect( s, SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
38 s->setSocket( socket ); 38 s->setSocket( socket );
39 } 39 }
40 40
41signals: 41signals:
42 void sendFile(QSocket*); 42 void sendFile(QSocket*);
43 void getFile(QSocket*); 43 void getFile(QSocket*);
44 void endConnect(); 44 void endConnect();
45private slots: 45private slots:
46 void discardClient() 46 void discardClient()
47 { 47 {
48 QSocket* socket = (QSocket*)sender(); 48 QSocket* socket = (QSocket*)sender();
49 delete socket; 49 delete socket;
50 emit endConnect(); 50 //emit endConnect();
51 } 51 }
52 void readClient() 52 void readClient()
53 { 53 {
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();