summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-23 07:35:02 (UTC)
committer zautrix <zautrix>2004-09-23 07:35:02 (UTC)
commite395b9a15f5047582c17665de85d28dad64b8a8e (patch) (side-by-side diff)
tree141b178531d66bfeb810cf9b6f2ba1cd54a7fce5
parente2bc785d2f98d2aeac6ab6a5e39ff4f6e679517b (diff)
downloadkdepimpi-e395b9a15f5047582c17665de85d28dad64b8a8e.zip
kdepimpi-e395b9a15f5047582c17665de85d28dad64b8a8e.tar.gz
kdepimpi-e395b9a15f5047582c17665de85d28dad64b8a8e.tar.bz2
fixes in kopi
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp105
-rw-r--r--korganizer/mainwindow.h38
2 files changed, 101 insertions, 42 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 2e6b5c8..460bbdc 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,74 +1,76 @@
#include <stdlib.h>
#include <qaction.h>
#include <qpopupmenu.h>
#include <qpainter.h>
#include <qwhatsthis.h>
+#include <qpushbutton.h>
#include <qmessagebox.h>
#include <qlineedit.h>
#include <qtextcodec.h>
#include <qfile.h>
#include <qdir.h>
#include <qapp.h>
#include <qfileinfo.h>
#include <qlabel.h>
#include <qmap.h>
#include <qwmatrix.h>
#include <qtextbrowser.h>
#include <qtextstream.h>
#ifndef DESKTOP_VERSION
#include <qpe/global.h>
#include <qpe/qpemenubar.h>
#include <qpe/qpetoolbar.h>
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qtopia/alarmserver.h>
#include <qtopia/qcopenvelope_qws.h>
+#include <unistd.h> // for sleep
#else
#include <qmenubar.h>
#include <qtoolbar.h>
#include <qapplication.h>
//#include <resource.h>
#endif
#include <libkcal/calendarlocal.h>
#include <libkcal/todo.h>
#include <libkdepim/ksyncprofile.h>
#include <libkcal/kincidenceformatter.h>
#include <libkdepim/kpimglobalprefs.h>
#include "calendarview.h"
#include "koviewmanager.h"
#include "datenavigator.h"
#include "koagendaview.h"
#include "koagenda.h"
#include "kodialogmanager.h"
#include "kdialogbase.h"
#include "kapplication.h"
#include "kofilterview.h"
#include "kstandarddirs.h"
#include "koprefs.h"
#include "kfiledialog.h"
#include "koglobals.h"
#include "kglobal.h"
#include "klocale.h"
#include "kconfig.h"
#include "simplealarmclient.h"
#include "externalapphandler.h"
using namespace KCal;
#ifndef _WIN32_
#include <unistd.h>
#else
#include "koimportoldialog.h"
#endif
#include "mainwindow.h"
int globalFlagBlockStartup;
MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
QMainWindow( parent, name )
{
#ifdef DESKTOP_VERSION
setFont( QFont("Arial"), 14 );
#endif
@@ -1101,102 +1103,97 @@ 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") );
}
-#if 0
-#include <libkcal/vcalformat.h>
-#include <libkcal/event.h>
-#include <libkcal/todo.h>
-#include <libkcal/incidence.h>
-#endif
+
void MainWindow::synchowto()
{
#if 0
QPtrList<Incidence> er = mCalendar->rawIncidences();
Incidence* inR = er.first();
VCalFormat vf;
QString strout;
while ( inR ) {
if ( inR->type() == "Todo" )
strout = vf.todoToString( (Todo *) inR );
if ( inR->type() == "Event" )
strout = vf.eventToString( (Event *) inR );
qDebug("incidence: \n%s\n ente\n\n",strout.latin1() );
inR = er.next();
}
#endif
displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") );
}
void MainWindow::faq()
{
displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
}
void MainWindow::whatsNew()
{
displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") );
}
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") );
}
@@ -1383,97 +1380,96 @@ void MainWindow::importBday()
}
void MainWindow::importQtopia()
{
#ifndef DESKTOP_VERSION
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
i18n("Import!"), i18n("Cancel"), 0,
0, 1 );
if ( result == 0 ) {
QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
mView->importQtopia( categories, datebook, todolist );
}
#else
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
i18n("Not supported \non desktop!\n"),
i18n("Ok"), i18n("Cancel"), 0,
0, 1 );
#endif
}
void MainWindow::saveOnClose()
{
KOPrefs *p = KOPrefs::instance();
p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
p->mToolBarUp = iconToolBar->x() > width()/2 ||
iconToolBar->y() > height()/2;
mView->writeSettings();
if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
save();
}
void MainWindow::slotModifiedChanged( bool changed )
{
if ( mBlockAtStartup )
return;
int msec;
// we store the changes after 1 minute,
// and for safety reasons after 10 minutes again
if ( !mBlockSaveFlag )
msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
else
msec = 1000 * 600;
mSaveTimer.start( msec, true ); // 1 minute
qDebug("KO: Saving File in %d secs!", msec/1000);
mCalendarModifiedFlag = true;
}
-#include <qfileinfo.h>
void MainWindow::save()
{
if ( mBlockSaveFlag )
return;
bool store = mBlockSaveFlag;
mBlockSaveFlag = true;
if ( mView->checkFileVersion( defaultFileName()) ) {
QTime neededSaveTime = QDateTime::currentDateTime().time();
setCaption(i18n("KO/Pi:Saving Data to File ..." ));
qDebug("KO: Start saving data to file!");
mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
mView->saveCalendar( defaultFileName() );
int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
mView->watchSavedFile();
qDebug("KO: Needed %d ms for saving.",msNeeded );
QString savemes;
savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
setCaption(savemes);
} else
setCaption(i18n("Saving cancelled!"));
mCalendarModifiedFlag = false;
mBlockSaveFlag = store;
}
void MainWindow::keyReleaseEvent ( QKeyEvent * e)
{
if ( !e->isAutoRepeat() ) {
mFlagKeyPressed = false;
}
}
void MainWindow::keyPressEvent ( QKeyEvent * e )
{
qApp->processEvents();
if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
e->ignore();
// qDebug(" ignore %d",e->isAutoRepeat() );
return;
}
if (! e->isAutoRepeat() )
mFlagKeyPressed = true;
KOPrefs *p = KOPrefs::instance();
bool showSelectedDates = false;
int size;
int pro = 0;
//qDebug("MainWindow::keyPressEvent ");
switch ( e->key() ) {
@@ -1821,97 +1817,96 @@ void MainWindow::importFile( QString fn, bool quick )
setCaption(i18n("Error importing file"));
}
}
}
void MainWindow::importIcal()
{
QString fn =KOPrefs::instance()->mLastImportFile;
fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
if ( fn == "" )
return;
importFile( fn, true );
}
void MainWindow::exportVCalendar()
{
QString fn = KOPrefs::instance()->mLastVcalFile;
fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
if ( fn == "" )
return;
QFileInfo info;
info.setFile( fn );
QString mes;
bool createbup = true;
if ( info. exists() ) {
mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
i18n("Overwrite!"), i18n("Cancel"), 0,
0, 1 );
if ( result != 0 ) {
createbup = false;
}
}
if ( createbup ) {
if ( mView->exportVCalendar( fn ) ) {
KOPrefs::instance()->mLastVcalFile = fn;
if ( fn.length() > 20 )
mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
else
mes = i18n("KO/Pi:Exported to %1").arg(fn );
setCaption(mes);
}
}
}
-#include <qpushbutton.h>
QString MainWindow::getPassword( )
{
QString retfile = "";
QDialog dia ( this, "input-dialog", true );
QLineEdit lab ( &dia );
lab.setEchoMode( QLineEdit::Password );
QVBoxLayout lay( &dia );
lay.setMargin(7);
lay.setSpacing(7);
lay.addWidget( &lab);
dia.setFixedSize( 230,50 );
dia.setCaption( i18n("Enter password") );
QPushButton pb ( "OK", &dia);
lay.addWidget( &pb );
connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
dia.show();
int res = dia.exec();
if ( res )
retfile = lab.text();
dia.hide();
qApp->processEvents();
return retfile;
}
void MainWindow::enableQuick()
{
QString retfile = "";
QDialog dia ( this, "input-dialog", true );
QLineEdit lab ( &dia );
QVBoxLayout lay( &dia );
lab.setText( KOPrefs::instance()->mPassiveSyncPort );
lay.setMargin(7);
lay.setSpacing(7);
QLabel label ( i18n("Port number (Default: 9197)"), &dia );
lay.addWidget( &label);
lay.addWidget( &lab);
dia.setFixedSize( 230,80 );
dia.setCaption( i18n("Enter port for Easy-Pi-Sync") );
QPushButton pb ( "OK", &dia);
lay.addWidget( &pb );
connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
dia.show();
int res = dia.exec();
if ( res )
retfile = lab.text();
else
return;
@@ -1956,99 +1951,132 @@ void MainWindow::sendFile(QSocket* socket)
save();
QString fileName = defaultFileName();
QFile file( fileName );
if (!file.open( IO_ReadOnly ) ) {
setCaption( i18n("Error open file") );
delete mSyncActionDialog;
mSyncActionDialog = 0;
qDebug("error open cal file ");
return ;
}
setCaption( i18n("Sending file...") );
QTextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
QTextStream os( socket );
os.setCodec( QTextCodec::codecForName("utf8") );
//os.setEncoding( QTextStream::UnicodeUTF8 );
while ( ! ts.atEnd() ) {
os << ts.readLine() << "\n";
}
//os << ts.read();
socket->close();
file.close();
setCaption( i18n("File sent. Waiting to get back synced file") );
qDebug("file sent ");
}
void MainWindow::getFile(QSocket* socket)
{
setCaption( i18n("Receiving synced file...") );
QString fileName = defaultFileName();
QFile file( fileName );
if (!file.open( IO_WriteOnly ) ) {
setCaption( i18n("Error open file") );
delete mSyncActionDialog;
mSyncActionDialog = 0;
qDebug("error open cal file ");
return ;
}
mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
QTextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
bool first = true;
while ( socket->canReadLine () || first ) {
first = false;
while ( socket->canReadLine () ) {
+ qDebug("avail %d ", socket->bytesAvailable () );
ts << socket->readLine ();
}
+ QTime ti;
+ ti.start();
+ while ( ti.elapsed () < 5000 && !socket->canReadLine () ) {
+ qDebug("waiting1a %d %d ",ti.elapsed (), socket->bytesAvailable () );
+ //qApp->processEvents();
+ qDebug("waiting1b %d ",ti.elapsed () );
+ if ( !socket->canReadLine () ) {
+ qDebug("waiting1c %d ",ti.elapsed () );
+ usleep( 100000);
+ }
+ //socket->waitForMore ( 100 );
+ }
+ ts << socket->readLine ();
+#if 0
+#ifdef DESKTOP_VERSION
socket->waitForMore ( 5000 );
+#else
+ // socket->waitForMore ( 5000 );
+ // seems to be broken in qt2
+ bool stop = false;
+ QTime ti;
+ ti.start();
+ while ( ti.elapsed < 5000 && !stop ) {
+ qApp->processEvents();
+ if ( socket->canReadLine () )
+ stop = true ;
+ else {
+ usleep( 100000 );
+
+ }
+ }
+#endif
+#endif
}
setCaption( i18n("File received - reloading calendar...") );
file.close();
socket->close();
mView->watchSavedFile();
mView->openCalendar( defaultFileName() );
setCaption( i18n("Easy-Pi-Sync successful!") );
delete mSyncActionDialog;
mSyncActionDialog = 0;
}
void MainWindow::endConnect()
{
setCaption( i18n("No file received - syncing successful") );
delete mSyncActionDialog;
mSyncActionDialog = 0;
}
void MainWindow::performQuick()
{
setCaption( i18n("Please input connection settings") );
QString retfile = "";
QDialog dia ( this, "input-dialog", true );
QLineEdit lab ( &dia );
QVBoxLayout lay( &dia );
QLabel label ( i18n("IP address\n(Example: 192.168.0.40)"), &dia );
lay.addWidget( &label);
lab.setText( KOPrefs::instance()->mActiveSyncIP );
lay.setMargin(7);
lay.setSpacing(7);
lay.addWidget( &lab);
QLabel label2 ( i18n("Port number (Default: 9197)"), &dia );
lay.addWidget( &label2);
QLineEdit lab2 ( &dia );
lab2.setText( KOPrefs::instance()->mActiveSyncPort );
lay.addWidget( &lab2);
dia.setFixedSize( 230,200 );
dia.setCaption( i18n("Enter port for Easy-Pi-Sync ") );
QPushButton pb ( "OK", &dia);
lay.addWidget( &pb );
connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
dia.show();
int res = dia.exec();
if ( !res ) {
setCaption( i18n("Syncing cancelled!") );
return;
}
dia.hide();
@@ -2064,98 +2092,106 @@ void MainWindow::performQuickQuick()
bool ok;
Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok);
if ( ! ok ) {
setCaption( i18n("Sorry, no valid port.Syncing cancelled.") );
return;
}
if ( !mCommandSocket ) {
mCommandSocket = new QSocket( this );
// delete mCommandSocket;
//mCommandSocket = new QSocket( this );
connect( mCommandSocket, SIGNAL(readyRead()), this, SLOT(readFileFromSocket()) );
}
QString host = KOPrefs::instance()->mActiveSyncIP;
mCommandSocket->connectToHost( host, port );
QTextStream os( mCommandSocket );
os.setEncoding( QTextStream::UnicodeUTF8 );
os << "GET\r\n";
setCaption( i18n("Sending request for remote file ...") );
}
void MainWindow::readFileFromSocket()
{
setCaption( i18n("Receiving remote file ...") );
qDebug("MainWindow::readFileFromSocket() ");
QString fileName;
#ifdef _WIN32_
fileName = defaultFileName() +"sync";
#else
fileName = "/tmp/kopitempfile.ics";
#endif
QFile file( fileName );
if (!file.open( IO_WriteOnly ) ) {
setCaption( i18n("Error: Cannot open temp file for write.") );
qDebug("Error open calender file for writing: %s",fileName.latin1() );
return ;
}
//QTextStream os2( mCommandSocket );
//os2.setEncoding( QTextStream::UnicodeUTF8 );
QTextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
bool first = true;
while ( mCommandSocket->canReadLine () || first) {
first = false;
while ( mCommandSocket->canReadLine () ) {
ts << mCommandSocket->readLine ();
+ }
+ QTime ti;
+ ti.start();
+ while ( ti.elapsed () < 5000 && !mCommandSocket->canReadLine () ) {
+ qApp->processEvents();
+ qDebug("waiting2 %d ",ti.elapsed () );
+ if ( !mCommandSocket->canReadLine () )
+ mCommandSocket->waitForMore ( 100 );
}
- mCommandSocket->waitForMore ( 5000 );
+ //mCommandSocket->waitForMore ( 5000 );
}
file.close();
mCommandSocket->close();
//delete mCommandSocket;
setCaption( i18n("Remote file saved to temp file.") );
//mCommandSocket = 0;
mCurrentSyncProfile = 2 ; // last file
mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
KSyncProfile* temp = new KSyncProfile ();
temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
temp->readConfig(&config);
KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
KOPrefs::instance()->mWriteBackInFuture = 0;
if ( temp->getWriteBackFuture() )
KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
setCaption( i18n("Remote file saved to temp file.") );
if ( ! syncWithFile( fileName , true ) ) {
setCaption( i18n("Syncing failed.") );
qDebug("Syncing failed ");
return;
}
if ( !mCommandSocketFinish ) {
mCommandSocketFinish = new QSocket( this );
}
mCommandSocketFinish->connectToHost( KOPrefs::instance()->mActiveSyncIP, KOPrefs::instance()->mActiveSyncPort.toUInt() );
QString host = KOPrefs::instance()->mActiveSyncIP;
QFile file2( fileName );
if (!file2.open( IO_ReadOnly ) ) {
setCaption( i18n("Error: Cannot open temp file for read.") );
qDebug("error open cal file ");
return ;
}
setCaption( i18n("Sending back synced file...") );
QTextStream ts2( &file2 );
ts2.setCodec( QTextCodec::codecForName("utf8") );
QTextStream os2( mCommandSocketFinish );
os2.setCodec( QTextCodec::codecForName("utf8") );
//os.setEncoding( QTextStream::UnicodeUTF8 );
@@ -2407,48 +2443,99 @@ void MainWindow::syncSSH()
} else {
setCaption ( i18n( "Syncronization sucessfully completed" ) );
}
}
}
return;
#if 0
system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics");
while ( timer.elapsed() < 5000 )
qApp->processEvents();
qDebug("MainWindow::merging) ");
mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 );
while ( mBlockSaveFlag )
qApp->processEvents();
save();
system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics");
#endif
}
void MainWindow::syncSharp()
{
if ( mCalendarModifiedFlag )
save();
mView->syncSharp();
slotModifiedChanged( true );
}
void MainWindow::syncPhone()
{
if ( mCalendarModifiedFlag )
save();
mView->syncPhone();
slotModifiedChanged( true );
}
void MainWindow::printSel( )
{
mView->viewManager()->agendaView()->agenda()->printSelection();
}
void MainWindow::printCal()
{
mView->print();//mCp->showDialog();
}
+
+
+
+KServerSocket:: KServerSocket ( Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ){;};
+
+void KServerSocket::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 );
+}
+
+void KServerSocket::discardClient()
+{
+ qDebug(" KServerSocket::discardClient()");
+ QSocket* socket = (QSocket*)sender();
+ delete socket;
+ //emit endConnect();
+}
+void KServerSocket::readClient()
+{
+ qDebug("KServerSocket readClient()");
+ QSocket* socket = (QSocket*)sender();
+ if ( socket->canReadLine() ) {
+ QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), socket->readLine() );
+ qDebug("KServerSocket socket->canReadLine()");
+ if ( tokens[0] == "GET" ) {
+ emit sendFile( socket );
+ }
+ if ( tokens[0] == "PUT" ) {
+ emit getFile( socket );
+ }
+ if ( tokens[0] == "STOP" ) {
+ emit endConnect();
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 5985d56..7b4fd27 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,116 +1,88 @@
#ifndef KORGE_MAINWINDOW_H
#define KORGE_MAINWINDOW_H
#include <qmainwindow.h>
#include <qtimer.h>
#include <qdict.h>
#include <qregexp.h>
#include <libkcal/incidence.h>
#include "simplealarmclient.h"
class QAction;
class CalendarView;
class KSyncProfile;
#ifdef DESKTOP_VERSION
#define QPEToolBar QToolBar
#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 );
- }
+ KServerSocket ( Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 );
+
+ void newConnection ( int 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();
- }
- }
- }
+ void discardClient();
+ void readClient();
};
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();
public slots:
virtual void showMaximized ();
void configureAgenda( int );
void recieve( const QCString& msg, const QByteArray& data );
static QString defaultFileName();
static QString resourcePath();
protected slots:
void setCaptionToDates();
int ringSync();
void multiSync( bool askforPrefs = false );
void about();
void licence();
void faq();
void usertrans();
void features();
void synchowto();
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();