-rw-r--r-- | bin/kdepim/kaddressbook/germantranslation.txt | 20 | ||||
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 22 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 2 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 97 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 6 |
5 files changed, 125 insertions, 22 deletions
diff --git a/bin/kdepim/kaddressbook/germantranslation.txt b/bin/kdepim/kaddressbook/germantranslation.txt index f64bfda..4a5122f 100644 --- a/bin/kdepim/kaddressbook/germantranslation.txt +++ b/bin/kdepim/kaddressbook/germantranslation.txt @@ -783,11 +783,31 @@ { "male","männlich" },
{ "female","weiblich" },
{ "Hide!","Verbergen!" },
{ "Show!","Anzeigen!" },
{ "Details","Details" },
{ "Search:","Suche:" },
+{ "Automatically sync with KDE-Desktop\nwhen receiving sync request","Synce automatisch mit KDE-Desktop\nwenn eine Sync-Anforderung kommt" },
+{ "Pi-Sync Port Error","Pi-Sync Port Fehler" },
+{ "<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?","<b>Anschalten von Pi-Sync fehlgeschlagen!</b> Fehler beim Ansprechen des Ports %1! Ist bereits eine andere Anwendung dabei diesen Port zu nutzen?" },
+{ "No valid port number:\n%1","Keine gültige Port Nummer:\n%1" },
+{ "Port number (Default: %1)\nValid range from 1 to 65535","Port Nummer (Standard: %1)\nGültiger Bereich von 1 bis 65535" },
+{ "Pi-Sync Error","Pi-Sync Fehler" },
+{ "Got send file request\nwith invalid password","Erhielt "sende Datei" Anfrage\nmit ungültigem Passwort" },
+{ "Got receive file request\nwith invalid password","Erhielt "empfange Datei" Anfrage\nmit ungültigem Passwort" },
+{ "Wrong password: Receiving remote file failed.","Falsches Passwort: Empfangen von entfernter Datei fehlgeschlagen." },
+{ "Please close error dialog on remote.","Bitte schließe Fehler-Dialog am entfernten Rechner" },
+{ "Unknown error on remote.","Unbekannter Fehler am entfernten Rechner" },
+{ "Pi-Sync: Connected!","Pi-Sync: Verbunden!" },
+{ "Receiving file from remote...","Empfange entfernte Datei..." },
+{ "Sending back synced file...","Sende synchronisierte Datei zurück..." },
+{ "Do you want to\nclear all sync info\nof all profiles?","Möchten Sie wirklich\ndie Sync-Info\nfür alle Profile\nlöschen?" },
+{ "Do you want to\nclear the sync\ninfo of profile\n%1?\n","Möchten Sie wirklich\ndie Sync-Info für Profil\n%1?\nlöschen" },
+{ "Sorry, no valid port.Syncing cancelled.","Sorry, kein gültiger Port. Syncing abgebrochen." },
+{ "Remote port number:\n(May be: 1 - 65535)","Ferne Port Nummer:\n(Darf sein: 1 - 65535)" },
+{ "Writing back file ...","Schreibe Datei zurück..." },
+{ "Sending back file ...","Sende Datei zurück..." },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
\ No newline at end of file diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 34e9b7f..ff5e095 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -954,13 +954,12 @@ { "command for downloading remote file to local device","Kommando zum Download der entfernten Datei zum lokalen Gerät" }, { "command for uploading local temp file to remote device","Kommando zum Upload der lokalen temp. Datei zum entfernten Gerät" }, { "Insert device where\nphone is connected. E.g.:\n","Füge Device ein, an dem\ndas Handy angeschlossen ist. Z.B.:\n" }, { "KDE-Pim sync config","KDE-Pim sync Konfig" }, { "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein,z.B.:\n" }, { "Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n","Empfohlen: Leer lassen!\n(So dass das Model\nautomatisch erkannt\nwerden kann)\nOder füge Model Name ein:\n" }, -{ "Port number (Default: %1)","Port Nummer (Default: %1)" }, { "Password to enable\naccess from remote:","Passwort um entfernten\nZugriff zuzulassen:" }, { "Automatically start\nat application startup","Starte automatisch\nbeim Programmstart" }, { "Automatically sync\nwith KDE-Desktop","Automatischer Sync\nmit dem KDE-Desktop" }, { "Enter port for Pi-Sync","Port Nummer für Pi-Sync" }, { "Disable Pi-Sync","Schalte Pi-Sync aus" }, { "Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!","Wollen Sie wirklich\nmit allen selektierten\nProfilen "Multi-Syncen"?\nDas Syncen dauert einige Zeit -\nalle Profile werden zweimal gesynct!" }, @@ -1503,13 +1502,32 @@ { "<p><b>Q</b>: Show next date with conflicting events\n ","<p><b>Q</b>: Zeige nächstes Datum mit Terminen im Konflikt\n " }, { "Week view mode uses row layout","Wochenansicht Modus nutzt Reihenlayout" }, { "The event\n%1\nconflicts with event\n%2\nat date\n%3.\n","Der Termin\n%1\nist im Konflikt mit Termin\n%2\nam Datum\n%3.\n" }, { "KO/Pi Conflict delected","KO/Pi Konflikt erkannt" }, { "Show date","Zeige Datum" }, { "No problem!","Null Problemo!" }, -{ "","" }, +{ "Automatically sync with KDE-Desktop\nwhen receiving sync request","Synce automatisch mit KDE-Desktop\nwenn eine Sync-Anforderung kommt" }, +{ "Pi-Sync Port Error","Pi-Sync Port Fehler" }, +{ "<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?","<b>Anschalten von Pi-Sync fehlgeschlagen!</b> Fehler beim Ansprechen des Ports %1! Ist bereits eine andere Anwendung dabei diesen Port zu nutzen?" }, +{ "No valid port number:\n%1","Keine gültige Port Nummer:\n%1" }, +{ "Port number (Default: %1)\nValid range from 1 to 65535","Port Nummer (Standard: %1)\nGültiger Bereich von 1 bis 65535" }, +{ "Pi-Sync Error","Pi-Sync Fehler" }, +{ "Got send file request\nwith invalid password","Erhielt "sende Datei" Anfrage\nmit ungültigem Passwort" }, +{ "Got receive file request\nwith invalid password","Erhielt "empfange Datei" Anfrage\nmit ungültigem Passwort" }, +{ "Wrong password: Receiving remote file failed.","Falsches Passwort: Empfangen von entfernter Datei fehlgeschlagen." }, +{ "Please close error dialog on remote.","Bitte schließe Fehler-Dialog am entfernten Rechner" }, +{ "Unknown error on remote.","Unbekannter Fehler am entfernten Rechner" }, +{ "Pi-Sync: Connected!","Pi-Sync: Verbunden!" }, +{ "Receiving file from remote...","Empfange entfernte Datei..." }, +{ "Sending back synced file...","Sende synchronisierte Datei zurück..." }, +{ "Do you want to\nclear all sync info\nof all profiles?","Möchten Sie wirklich\ndie Sync-Info\nfür alle Profile\nlöschen?" }, +{ "Do you want to\nclear the sync\ninfo of profile\n%1?\n","Möchten Sie wirklich\ndie Sync-Info für Profil\n%1?\nlöschen" }, +{ "Sorry, no valid port.Syncing cancelled.","Sorry, kein gültiger Port. Syncing abgebrochen." }, +{ "Remote port number:\n(May be: 1 - 65535)","Ferne Port Nummer:\n(Darf sein: 1 - 65535)" }, +{ "Writing back file ...","Schreibe Datei zurück..." }, +{ "Sending back file ...","Sende Datei zurück..." }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 68d1bc6..940ea91 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -445,13 +445,13 @@ void CalendarView::init() mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); } mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); //QBoxLayout * leftFrameLayout; topLayout->addWidget( mMainFrame ); #ifdef DESKTOP_VERSION - mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this ); + mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this ); topLayout->addWidget( mDateScrollBar ); connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); if ( QApplication::desktop()->width() < 800 ) mDateScrollBar->hide(); #endif //mainBoxLayout->addWidget (mLeftFrame); diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index fc0ac6b..f2ee0ab 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -350,13 +350,13 @@ void KSyncManager::enableQuick( bool ask ) QLineEdit lab ( &dia ); QVBoxLayout lay( &dia ); lab.setText( mPrefs->mPassiveSyncPort ); lay.setMargin(7); lay.setSpacing(7); int po = 9197+mTargetApp; - QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); + QLabel label ( i18n("Port number (Default: %1)\nValid range from 1 to 65535").arg(po), &dia ); lay.addWidget( &label); lay.addWidget( &lab); QLineEdit lepw ( &dia ); lepw.setText( mPrefs->mPassiveSyncPw ); QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); @@ -412,34 +412,39 @@ void KSyncManager::enableQuick( bool ask ) else autoStart = mPrefs->mPassiveSyncAutoStart; if ( autoStart != mPrefs->mPassiveSyncAutoStart ) changed = true; bool ok; mPrefs->mPassiveSyncAutoStart = false; - Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); - if ( ! ok ) { - KMessageBox::information( 0, i18n("No valid port")); + Q_UINT32 port_t = mPrefs->mPassiveSyncPort.toUInt(&ok); + qDebug("%d ", port_t); + if ( ! ok || port_t > 65535 ) { + KMessageBox::information( 0, i18n("No valid port number:\n%1").arg ( mPrefs->mPassiveSyncPort ), i18n("Pi-Sync Port Error")); return; } + Q_UINT16 port = port_t; //qDebug("port %d ", port); mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); mServerSocket->setFileName( defaultFileName() );//bbb if ( !mServerSocket->ok() ) { - KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); + QTimer::singleShot( 2000, this, SLOT ( displayErrorPort() ) ); delete mServerSocket; mServerSocket = 0; return; } mPrefs->mPassiveSyncAutoStart = autoStart; if ( changed ) { mPrefs->writeConfig(); } connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); } - +void KSyncManager::displayErrorPort() +{ + KMessageBox::information( 0, i18n("<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?").arg( mPrefs->mPassiveSyncPort) , i18n("Pi-Sync Port Error")); +} void KSyncManager::syncLocalFile() { QString fn =mPrefs->mLastSyncedLocalFile; QString ext; @@ -793,13 +798,13 @@ bool KSyncManager::edit_pisync_options() QLineEdit le1 (&dia ); lay.addWidget( &le1 ); QLabel lab2 ( i18n("Remote IP address:"), &dia); lay.addWidget( &lab2 ); QLineEdit le2 (&dia ); lay.addWidget( &le2 ); - QLabel lab3 ( i18n("Remote port number:"), &dia); + QLabel lab3 ( i18n("Remote port number:\n(May be: 1 - 65535)"), &dia); lay.addWidget( &lab3 ); QLineEdit le3 (&dia ); lay.addWidget( &le3 ); QPushButton pb ( "OK", &dia); lay.addWidget( &pb ); connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); @@ -1185,14 +1190,16 @@ void KSyncManager::readFileFromSocket() if ( ! syncWithFile( fileName , true ) ) { mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); syncOK = false; } KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); - if ( mWriteBackFile && syncOK ) + if ( mWriteBackFile && syncOK ) { + mParent->topLevelWidget()->setCaption( i18n("Sending back file ...") ); commandSocket->writeFile( fileName ); + } else { commandSocket->sendStop(); if ( syncOK ) mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); mPisyncFinished = true; } @@ -1289,17 +1296,17 @@ void KServerSocket::readClient() } } } void KServerSocket::displayErrorMessage() { if ( mErrorMessage == 1 ) { - KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); + KMessageBox::error( 0, i18n("Got send file request\nwith invalid password"), i18n("Pi-Sync Error")); mErrorMessage = 0; } else if ( mErrorMessage == 2 ) { - KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password")); + KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password"), i18n("Pi-Sync Error")); mErrorMessage = 0; } } void KServerSocket::error_connect( QString errmess ) { QTextStream os( mSocket ); @@ -1463,19 +1470,25 @@ KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, mFirstLine = true; mPort = port; mHost = host; tlw = cap; mRetVal = quiet; mTimerSocket = new QTimer ( this ); - connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); + connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( updateConnectDialog() ) ); + mConnectProgress.setCaption( i18n("Pi-Sync") ); + connect( &mConnectProgress, SIGNAL ( cancelled () ), this, SLOT ( deleteSocket() ) ); + mConnectCount = -1; } void KCommandSocket::sendFileRequest() { if ( tlw ) tlw->setCaption( i18n("Connected! Sending request for remote file ...") ); - mTimerSocket->start( 300000 ); + mConnectProgress.hide(); + mConnectCount = 300;mConnectMax = 300; + mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") ); + mTimerSocket->start( 100, true ); QTextStream os( mSocket ); os.setEncoding( QTextStream::Latin1 ); QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); os << "GET " << mPassWord << curDt <<"\r\n\r\n"; } @@ -1490,53 +1503,88 @@ void KCommandSocket::readFile( QString fn ) } mFileString = ""; mFileName = fn; mFirst = true; if ( tlw ) tlw->setCaption( i18n("Trying to connect to remote...") ); - mTimerSocket->start( 20000 ); + mConnectCount = 30;mConnectMax = 30; + mTimerSocket->start( 1000, true ); mSocket->connectToHost( mHost, mPort ); qDebug("KSS: Waiting for connection"); } - +void KCommandSocket::updateConnectDialog() +{ + + if ( mConnectCount == mConnectMax ) { + //qDebug("MAXX %d", mConnectMax); + mConnectProgress.setTotalSteps ( 30 ); + mConnectProgress.show(); + mConnectProgress.setLabelText( i18n("Trying to connect to remote...") ); + } + //qDebug("updateConnectDialog() %d", mConnectCount); + mConnectProgress.raise(); + mConnectProgress.setProgress( (mConnectMax - mConnectCount)%30 ); + --mConnectCount; + if ( mConnectCount > 0 ) + mTimerSocket->start( 1000, true ); + else + deleteSocket(); + +} void KCommandSocket::writeFile( QString fileName ) { if ( !mSocket ) { mSocket = new QSocket( this ); connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); } mFileName = fileName ; - mTimerSocket->start( 20000 ); + mConnectCount = 30;mConnectMax = 30; + mTimerSocket->start( 1000, true ); mSocket->connectToHost( mHost, mPort ); } void KCommandSocket::writeFileToSocket() { mTimerSocket->stop(); QFile file2( mFileName ); if (!file2.open( IO_ReadOnly ) ) { + mConnectProgress.hide(); + mConnectCount = -1; mRetVal= errorW; mSocket->close(); if ( mSocket->state() == QSocket::Idle ) QTimer::singleShot( 10, this , SLOT ( deleteSocket())); return ; } + mConnectProgress.setTotalSteps ( file2.size() ); + mConnectProgress.show(); + int count = 0; + mConnectProgress.setLabelText( i18n("Sending back synced file...") ); + mConnectProgress.setProgress( count ); + mConnectProgress.blockSignals( true ); QTextStream ts2( &file2 ); ts2.setEncoding( QTextStream::Latin1 ); QTextStream os2( mSocket ); os2.setEncoding( QTextStream::Latin1 ); os2 << "PUT " << mPassWord << "\r\n\r\n";; while ( ! ts2.atEnd() ) { - os2 << ts2.readLine() << "\r\n"; + qApp->processEvents(); + mConnectProgress.setProgress( count ); + QString temp = ts2.readLine(); + count += temp.length(); + os2 << temp << "\r\n"; } + file2.close(); + mConnectProgress.hide(); + mConnectCount = -1; os2 << "\r\n"; mRetVal= successW; - file2.close(); mSocket->close(); if ( mSocket->state() == QSocket::Idle ) QTimer::singleShot( 10, this , SLOT ( deleteSocket())); + mConnectProgress.blockSignals( false ); } void KCommandSocket::sendStop() { if ( !mSocket ) { mSocket = new QSocket( this ); connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); @@ -1551,14 +1599,14 @@ void KCommandSocket::sendStop() } void KCommandSocket::startReadFileFromSocket() { if ( ! mFirst ) return; + mConnectProgress.setLabelText( i18n("Receiving file from remote...") ); mFirst = false; - mTimerSocket->stop(); mFileString = ""; mTime.start(); mFirstLine = true; QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) )); } @@ -1568,12 +1616,14 @@ void KCommandSocket::readFileFromSocket() while ( mSocket->canReadLine () ) { mTime.restart(); QString line = mSocket->readLine (); if ( mFirstLine ) { mFirstLine = false; if ( line.left( 6 ) == "ERROR_" ) { + mTimerSocket->stop(); + mConnectCount = -1; if ( line.left( 8 ) == "ERROR_PW" ) { mRetVal = errorPW; deleteSocket(); return ; } if ( line.left( 8 ) == "ERROR_CA" ) { @@ -1602,12 +1652,15 @@ void KCommandSocket::readFileFromSocket() if ( mTime.elapsed () < 3000 ) { // wait for more //qDebug("waitformore "); QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); return; } + mTimerSocket->stop(); + mConnectCount = -1; + mConnectProgress.hide(); QString fileName = mFileName; QFile file ( fileName ); if (!file.open( IO_WriteOnly ) ) { mFileString = ""; mRetVal = errorR; qDebug("KSS:Error open temp sync file for writing: %s",fileName.latin1() ); @@ -1629,27 +1682,33 @@ void KCommandSocket::readFileFromSocket() deleteSocket(); } void KCommandSocket::deleteSocket() { //qDebug("KCommandSocket::deleteSocket() "); - if ( mTimerSocket->isActive () ) { + mConnectProgress.hide(); + + if ( mConnectCount >= 0 ) { mTimerSocket->stop(); mRetVal = errorTO; qDebug("KCS::Connection to remote host timed out"); if ( mSocket ) { mSocket->close(); //if ( mSocket->state() == QSocket::Idle ) // deleteSocket(); delete mSocket; mSocket = 0; } + if ( mConnectCount == 0 ) KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?")); + else if ( tlw ) + tlw->setCaption( i18n("Connection to remote host cancelled!") ); emit commandFinished( this, mRetVal ); return; } //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); if ( mSocket) delete mSocket; mSocket = 0; + qDebug("commandFinished "); emit commandFinished( this, mRetVal ); } diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 30ec1e6..e6738b6 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -26,12 +26,13 @@ #include <qstring.h> #include <qsocket.h> #include <qdatetime.h> #include <qserversocket.h> #include <qtextstream.h> #include <qregexp.h> +#include <qprogressdialog.h> class QPopupMenu; class KSyncProfile; class KPimPrefs; class QWidget; class KSyncManager; @@ -83,21 +84,25 @@ class KCommandSocket : public QObject void readFile( QString ); void writeFile( QString ); void sendStop(); private slots : void sendFileRequest(); + void updateConnectDialog(); signals: void commandFinished( KCommandSocket*, int ); private slots: void startReadFileFromSocket(); void readFileFromSocket(); void deleteSocket(); void writeFileToSocket(); private : + int mConnectCount; + int mConnectMax; + QProgressDialog mConnectProgress; QWidget* tlw; QSocket* mSocket; QString mPassWord; Q_UINT16 mPort; QString mHost; QString mFileName; @@ -202,12 +207,13 @@ class KSyncManager : public QObject TargetApp mTargetApp; QPopupMenu* mSyncMenu; QProgressBar* bar; bool mSyncWithDesktop; private slots: + void displayErrorPort(); void confSync(); }; |