summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
authorzautrix <zautrix>2004-10-04 22:10:20 (UTC)
committer zautrix <zautrix>2004-10-04 22:10:20 (UTC)
commitc22811d11414872fc0525350a8a1afdae61be346 (patch) (side-by-side diff)
treedaafa0c4333022d44dafb2945ba36ff58d5c45d1 /korganizer/mainwindow.cpp
parentf53ef630b9299ceae666e64da8ce022813795ed6 (diff)
downloadkdepimpi-c22811d11414872fc0525350a8a1afdae61be346.zip
kdepimpi-c22811d11414872fc0525350a8a1afdae61be346.tar.gz
kdepimpi-c22811d11414872fc0525350a8a1afdae61be346.tar.bz2
many sync fixes
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp94
1 files changed, 26 insertions, 68 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index bce2a54..fe7e6d3 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -873,7 +873,4 @@ void MainWindow::fillSyncMenu()
}
syncMenu->insertSeparator();
- syncMenu->insertItem( i18n("New Pi-Sync!"), 4 );
- syncMenu->insertItem( i18n("Quick Pi-Sync!"), 5 );
- syncMenu->insertSeparator();
syncMenu->insertItem( i18n("Multiple sync"), 1 );
syncMenu->insertSeparator();
@@ -953,4 +950,9 @@ int MainWindow::ringSync()
KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
syncPhone();
+ } else if ( temp->getIsPiSync() ) {
+ mPassWordPiSync = temp->getRemotePw();
+ KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
+ KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
+ syncPi();
} else
syncRemote( temp, false );
@@ -1037,12 +1039,4 @@ void MainWindow::slotSyncMenu( int action )
return;
}
- if ( action == 4 ) {
- performQuick();
- return;
- }
- if ( action == 5 ) {
- performQuickQuick();
- return;
- }
if (mBlockSaveFlag)
@@ -1083,4 +1077,9 @@ void MainWindow::slotSyncMenu( int action )
KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
syncPhone();
+ } else if ( temp->getIsPiSync() ) {
+ mPassWordPiSync = temp->getRemotePw();
+ KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
+ KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
+ syncPi();
} else
syncRemote( temp );
@@ -1956,45 +1955,6 @@ void MainWindow::getFile( bool success )
-void MainWindow::performQuick()
+void MainWindow::syncPi()
{
-
- 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);
-
- QLineEdit lepw ( &dia );
- lepw.setText( mPassWordPiSync );
- QLabel label3 ( i18n("Password to enable\naccess to remote:"), &dia );
- lay.addWidget( &label3);
- lay.addWidget( &lepw);
-
- dia.setFixedSize( 230,200 );
- dia.setCaption( i18n("Enter port for 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;
- }
- mPassWordPiSync = lepw.text();
- dia.hide();
- KOPrefs::instance()->mActiveSyncPort = lab2.text();
- KOPrefs::instance()->mActiveSyncIP = lab.text();
qApp->processEvents();
performQuickQuick();
@@ -2378,5 +2338,5 @@ KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject
void KServerSocket::newConnection ( int socket )
{
- qDebug("KServerSocket:New connection %d ", socket);
+ // qDebug("KServerSocket:New connection %d ", socket);
if ( mSocket ) {
qDebug("KServerSocket::newConnection Socket deleted! ");
@@ -2392,7 +2352,6 @@ void KServerSocket::newConnection ( int socket )
void KServerSocket::discardClient()
{
- qDebug(" KServerSocket::discardClient()");
+ //qDebug(" KServerSocket::discardClient()");
if ( mSocket ) {
- qDebug("delete ");
delete mSocket;
mSocket = 0;
@@ -2406,8 +2365,7 @@ void KServerSocket::readClient()
return;
}
- qDebug("KServerSocket readClient()");
+ //qDebug("KServerSocket readClient()");
if ( mSocket->canReadLine() ) {
QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), mSocket->readLine() );
- qDebug("KServerSocket socket->canReadLine()");
if ( tokens[0] == "GET" ) {
if ( tokens[1] == mPassWord )
@@ -2441,5 +2399,5 @@ void KServerSocket::end_connect()
void KServerSocket::send_file()
{
- qDebug("MainWindow::sendFile(QSocket* s) ");
+ //qDebug("MainWindow::sendFile(QSocket* s) ");
if ( mSyncActionDialog )
delete mSyncActionDialog;
@@ -2479,6 +2437,5 @@ void KServerSocket::send_file()
//os << ts.read();
file.close();
- mSyncActionDialog->setCaption( i18n("Waiting to get back synced file") );
- qDebug("file sent ");
+ mSyncActionDialog->setCaption( i18n("Waiting for synced file...") );
mSocket->close();
if ( mSocket->state() == QSocket::Idle )
@@ -2497,10 +2454,10 @@ void KServerSocket::get_file()
void KServerSocket::readBackFileFromSocket()
{
- qDebug("readBackFileFromSocket() %d ", piTime.elapsed ());
+ //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ());
while ( mSocket->canReadLine () ) {
piTime.restart();
QString line = mSocket->readLine ();
piFileString += line;
- qDebug("readline: %s ", line.latin1());
+ //qDebug("readline: %s ", line.latin1());
mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) );
@@ -2508,5 +2465,5 @@ void KServerSocket::readBackFileFromSocket()
if ( piTime.elapsed () < 3000 ) {
// wait for more
- qDebug("waitformore ");
+ //qDebug("waitformore ");
QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) ));
return;
@@ -2527,5 +2484,4 @@ void KServerSocket::readBackFileFromSocket()
QTextStream ts ( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
- qDebug("finish ");
mSyncActionDialog->setCaption( i18n("Writing file to disk...") );
ts << piFileString;
@@ -2582,4 +2538,5 @@ void KCommandSocket::writeFile( QString fileName )
connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
}
+ mSocket->connectToHost( mHost, mPort );
QTextStream ts2( &file2 );
ts2.setCodec( QTextCodec::codecForName("utf8") );
@@ -2590,4 +2547,5 @@ void KCommandSocket::writeFile( QString fileName )
os2 << ts2.readLine() << "\n";
}
+ mRetVal= true;
mSocket->close();
if ( mSocket->state() == QSocket::Idle )
@@ -2602,4 +2560,5 @@ void KCommandSocket::sendStop()
connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
}
+ mSocket->connectToHost( mHost, mPort );
QTextStream os2( mSocket );
os2.setCodec( QTextCodec::codecForName("utf8") );
@@ -2624,14 +2583,14 @@ void KCommandSocket::startReadFileFromSocket()
void KCommandSocket::readFileFromSocket()
{
- qDebug("readBackFileFromSocket() %d ", mTime.elapsed ());
+ //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ());
while ( mSocket->canReadLine () ) {
mTime.restart();
QString line = mSocket->readLine ();
mFileString += line;
- qDebug("readline: %s ", line.latin1());
+ //qDebug("readline: %s ", line.latin1());
}
if ( mTime.elapsed () < 3000 ) {
// wait for more
- qDebug("waitformore ");
+ //qDebug("waitformore ");
QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) ));
return;
@@ -2650,5 +2609,4 @@ void KCommandSocket::readFileFromSocket()
QTextStream ts ( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
- qDebug("finish ");
ts << mFileString;
file.close();
@@ -2669,5 +2627,5 @@ void KCommandSocket::deleteSocket()
mRetVal = false;
}
- qDebug("KCommandSocket::deleteSocket() %d", mRetVal );
+ //qDebug("KCommandSocket::deleteSocket() %d", mRetVal );
if ( mSocket)
delete mSocket;