summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-22 22:21:06 (UTC)
committer zautrix <zautrix>2004-09-22 22:21:06 (UTC)
commit772411a6c16f9b2299bd173116faeb4482325bcc (patch) (side-by-side diff)
treeb70a4f4964bcf32e786fab82eaea8de0693bd841
parente29076add5876c7dd46ff35ab0cbc2ad2c496713 (diff)
downloadkdepimpi-772411a6c16f9b2299bd173116faeb4482325bcc.zip
kdepimpi-772411a6c16f9b2299bd173116faeb4482325bcc.tar.gz
kdepimpi-772411a6c16f9b2299bd173116faeb4482325bcc.tar.bz2
bugfixes
Diffstat (more/less context) (show 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
@@ -1918,48 +1918,50 @@ void MainWindow::enableQuick()
qApp->processEvents();
KOPrefs::instance()->mPassiveSyncPort = retfile;
bool ok;
Q_UINT16 port = retfile.toUInt(&ok);
if ( ! ok ) {
qDebug("no valid port ");
return;
}
qDebug("port %d ", port);
mServerSocket = new KServerSocket ( port ,1 );
qDebug("connected ");
if ( !mServerSocket->ok() ) {
qWarning("Failed to bind to port %d", port);
delete mServerSocket;
mServerSocket = 0;
return;
}
connect( mServerSocket, SIGNAL ( sendFile(QSocket*) ), this, SLOT ( sendFile(QSocket*) ) );
connect( mServerSocket, SIGNAL ( getFile(QSocket*) ), this, SLOT ( getFile(QSocket*) ) );
}
void MainWindow::sendFile(QSocket* socket)
{
setCaption( i18n("Received request for file") );
qDebug("MainWindow::sendFile(QSocket* s) ");
+ if ( mSyncActionDialog )
+ delete mSyncActionDialog;
mSyncActionDialog = new QDialog ( this, "input-dialog", true );
mSyncActionDialog->setCaption(i18n("KO/Pi - WARNING"));
QLabel* label = new QLabel( i18n("Synchronizing...\nDo not use\nthis application!\n"), mSyncActionDialog );
QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog );
lay->addWidget( label);
lay->setMargin(7);
lay->setSpacing(7);
mSyncActionDialog->setFixedSize( 200,100 );
mSyncActionDialog->show();
qApp->processEvents();
qDebug("saving ... ");
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 );
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 58081f6..9bb2302 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -26,49 +26,49 @@ 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();
+ //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;
}