-rw-r--r-- | libkdepim/ksyncmanager.cpp | 97 |
1 files changed, 50 insertions, 47 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 5708dfc..c844627 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -36,9 +36,9 @@ | |||
36 | 36 | ||
37 | #include <qdir.h> | 37 | #include <qdir.h> |
38 | #include <qprogressbar.h> | 38 | #include <q3progressbar.h> |
39 | #include <qpopupmenu.h> | 39 | #include <q3popupmenu.h> |
40 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
41 | #include <qradiobutton.h> | 41 | #include <qradiobutton.h> |
42 | #include <qbuttongroup.h> | 42 | #include <q3buttongroup.h> |
43 | #include <qtimer.h> | 43 | #include <qtimer.h> |
44 | #include <qmessagebox.h> | 44 | #include <qmessagebox.h> |
@@ -51,4 +51,7 @@ | |||
51 | #include <qcheckbox.h> | 51 | #include <qcheckbox.h> |
52 | #include <qapplication.h> | 52 | #include <qapplication.h> |
53 | #include <QDesktopWidget> | ||
54 | //Added by qt3to4: | ||
55 | #include <Q3VBoxLayout> | ||
53 | 56 | ||
54 | #include <klocale.h> | 57 | #include <klocale.h> |
@@ -60,9 +63,9 @@ QDateTime KSyncManager::mRequestedSyncEvent; | |||
60 | 63 | ||
61 | 64 | ||
62 | KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) | 65 | KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, Q3PopupMenu* syncmenu) |
63 | : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu) | 66 | : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu) |
64 | { | 67 | { |
65 | mServerSocket = 0; | 68 | mServerSocket = 0; |
66 | bar = new QProgressBar ( 1, 0 ); | 69 | bar = new Q3ProgressBar ( 1, 0 ); |
67 | bar->setCaption (""); | 70 | bar->setCaption (""); |
68 | mWriteBackInPast = 2; | 71 | mWriteBackInPast = 2; |
@@ -90,5 +93,5 @@ void KSyncManager::fillSyncMenu() | |||
90 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); | 93 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); |
91 | mSyncMenu->insertSeparator(); | 94 | mSyncMenu->insertSeparator(); |
92 | QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); | 95 | Q3PopupMenu *clearMenu = new Q3PopupMenu ( mSyncMenu ); |
93 | mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); | 96 | mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); |
94 | clearMenu->insertItem( i18n("For all profiles"), 1 ); | 97 | clearMenu->insertItem( i18n("For all profiles"), 1 ); |
@@ -356,5 +359,5 @@ void KSyncManager::enableQuick( bool ask ) | |||
356 | QDialog dia ( 0, "input-dialog", true ); | 359 | QDialog dia ( 0, "input-dialog", true ); |
357 | QLineEdit lab ( &dia ); | 360 | QLineEdit lab ( &dia ); |
358 | QVBoxLayout lay( &dia ); | 361 | Q3VBoxLayout lay( &dia ); |
359 | lab.setText( mPrefs->mPassiveSyncPort ); | 362 | lab.setText( mPrefs->mPassiveSyncPort ); |
360 | lay.setMargin(7); | 363 | lay.setMargin(7); |
@@ -805,5 +808,5 @@ bool KSyncManager::edit_pisync_options() | |||
805 | QDialog dia( mParent, "dia", true ); | 808 | QDialog dia( mParent, "dia", true ); |
806 | dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice ); | 809 | dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice ); |
807 | QVBoxLayout lay ( &dia ); | 810 | Q3VBoxLayout lay ( &dia ); |
808 | lay.setSpacing( 5 ); | 811 | lay.setSpacing( 5 ); |
809 | lay.setMargin( 3 ); | 812 | lay.setMargin( 3 ); |
@@ -839,6 +842,6 @@ bool KSyncManager::edit_sync_options() | |||
839 | QDialog dia( mParent, "dia", true ); | 842 | QDialog dia( mParent, "dia", true ); |
840 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); | 843 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); |
841 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); | 844 | Q3ButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); |
842 | QVBoxLayout lay ( &dia ); | 845 | Q3VBoxLayout lay ( &dia ); |
843 | lay.setSpacing( 2 ); | 846 | lay.setSpacing( 2 ); |
844 | lay.setMargin( 3 ); | 847 | lay.setMargin( 3 ); |
@@ -892,5 +895,5 @@ QString KSyncManager::getPassword( ) | |||
892 | QLineEdit lab ( &dia ); | 895 | QLineEdit lab ( &dia ); |
893 | lab.setEchoMode( QLineEdit::Password ); | 896 | lab.setEchoMode( QLineEdit::Password ); |
894 | QVBoxLayout lay( &dia ); | 897 | Q3VBoxLayout lay( &dia ); |
895 | lay.setMargin(7); | 898 | lay.setMargin(7); |
896 | lay.setSpacing(7); | 899 | lay.setSpacing(7); |
@@ -1335,5 +1338,5 @@ void KSyncManager::readFileFromSocket() | |||
1335 | } | 1338 | } |
1336 | 1339 | ||
1337 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) | 1340 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : Q3ServerSocket( port, backlog, parent, name ) |
1338 | { | 1341 | { |
1339 | mPendingConnect = 0; | 1342 | mPendingConnect = 0; |
@@ -1351,5 +1354,5 @@ void KServerSocket::waitForSocketFinish() | |||
1351 | return; | 1354 | return; |
1352 | } | 1355 | } |
1353 | mSocket = new QSocket( this ); | 1356 | mSocket = new Q3Socket( this ); |
1354 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 1357 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
1355 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 1358 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
@@ -1373,5 +1376,5 @@ void KServerSocket::newConnection ( int socket ) | |||
1373 | } | 1376 | } |
1374 | mPendingConnect = 0; | 1377 | mPendingConnect = 0; |
1375 | mSocket = new QSocket( this ); | 1378 | mSocket = new Q3Socket( this ); |
1376 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 1379 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
1377 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 1380 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
@@ -1463,9 +1466,9 @@ void KServerSocket::displayErrorMessage() | |||
1463 | void KServerSocket::error_connect( QString errmess ) | 1466 | void KServerSocket::error_connect( QString errmess ) |
1464 | { | 1467 | { |
1465 | QTextStream os( mSocket ); | 1468 | Q3TextStream os( mSocket ); |
1466 | os.setEncoding( QTextStream::Latin1 ); | 1469 | os.setEncoding( Q3TextStream::Latin1 ); |
1467 | os << errmess ; | 1470 | os << errmess ; |
1468 | mSocket->close(); | 1471 | mSocket->close(); |
1469 | if ( mSocket->state() == QSocket::Idle ) { | 1472 | if ( mSocket->state() == Q3Socket::Idle ) { |
1470 | QTimer::singleShot( 0, this , SLOT ( discardClient())); | 1473 | QTimer::singleShot( 0, this , SLOT ( discardClient())); |
1471 | } | 1474 | } |
@@ -1485,5 +1488,5 @@ void KServerSocket::send_file() | |||
1485 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); | 1488 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); |
1486 | label->setAlignment ( Qt::AlignHCenter ); | 1489 | label->setAlignment ( Qt::AlignHCenter ); |
1487 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); | 1490 | Q3VBoxLayout* lay = new Q3VBoxLayout( mSyncActionDialog ); |
1488 | lay->addWidget( label); | 1491 | lay->addWidget( label); |
1489 | lay->setMargin(7); | 1492 | lay->setMargin(7); |
@@ -1537,5 +1540,5 @@ void KServerSocket::send_file() | |||
1537 | QString fileName = mFileName; | 1540 | QString fileName = mFileName; |
1538 | QFile file( fileName ); | 1541 | QFile file( fileName ); |
1539 | if (!file.open( IO_ReadOnly ) ) { | 1542 | if (!file.open( QIODevice::ReadOnly ) ) { |
1540 | mErrorMessage = 0; | 1543 | mErrorMessage = 0; |
1541 | end_connect(); | 1544 | end_connect(); |
@@ -1544,9 +1547,9 @@ void KServerSocket::send_file() | |||
1544 | } | 1547 | } |
1545 | mSyncActionDialog->setCaption( i18n("Sending file...") ); | 1548 | mSyncActionDialog->setCaption( i18n("Sending file...") ); |
1546 | QTextStream ts( &file ); | 1549 | Q3TextStream ts( &file ); |
1547 | ts.setEncoding( QTextStream::Latin1 ); | 1550 | ts.setEncoding( Q3TextStream::Latin1 ); |
1548 | 1551 | ||
1549 | QTextStream os( mSocket ); | 1552 | Q3TextStream os( mSocket ); |
1550 | os.setEncoding( QTextStream::Latin1 ); | 1553 | os.setEncoding( Q3TextStream::Latin1 ); |
1551 | while ( ! ts.atEnd() ) { | 1554 | while ( ! ts.atEnd() ) { |
1552 | os << ts.readLine() << "\r\n"; | 1555 | os << ts.readLine() << "\r\n"; |
@@ -1557,5 +1560,5 @@ void KServerSocket::send_file() | |||
1557 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); | 1560 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); |
1558 | mSocket->close(); | 1561 | mSocket->close(); |
1559 | if ( mSocket->state() == QSocket::Idle ) | 1562 | if ( mSocket->state() == Q3Socket::Idle ) |
1560 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 1563 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
1561 | } | 1564 | } |
@@ -1589,5 +1592,5 @@ void KServerSocket::readBackFileFromSocket() | |||
1589 | QString fileName = mFileName; | 1592 | QString fileName = mFileName; |
1590 | QFile file ( fileName ); | 1593 | QFile file ( fileName ); |
1591 | if (!file.open( IO_WriteOnly ) ) { | 1594 | if (!file.open( QIODevice::WriteOnly ) ) { |
1592 | delete mSyncActionDialog; | 1595 | delete mSyncActionDialog; |
1593 | mSyncActionDialog = 0; | 1596 | mSyncActionDialog = 0; |
@@ -1602,10 +1605,10 @@ void KServerSocket::readBackFileFromSocket() | |||
1602 | 1605 | ||
1603 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 1606 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
1604 | QTextStream ts ( &file ); | 1607 | Q3TextStream ts ( &file ); |
1605 | ts.setEncoding( QTextStream::Latin1 ); | 1608 | ts.setEncoding( Q3TextStream::Latin1 ); |
1606 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); | 1609 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); |
1607 | ts << piFileString; | 1610 | ts << piFileString; |
1608 | mSocket->close(); | 1611 | mSocket->close(); |
1609 | if ( mSocket->state() == QSocket::Idle ) | 1612 | if ( mSocket->state() == Q3Socket::Idle ) |
1610 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 1613 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
1611 | file.close(); | 1614 | file.close(); |
@@ -1649,6 +1652,6 @@ void KCommandSocket::sendFileRequest() | |||
1649 | mConnectProgress.setLabelText( i18n("Waiting for remote file...") ); | 1652 | mConnectProgress.setLabelText( i18n("Waiting for remote file...") ); |
1650 | mTimerSocket->start( 100, true ); | 1653 | mTimerSocket->start( 100, true ); |
1651 | QTextStream os( mSocket ); | 1654 | Q3TextStream os( mSocket ); |
1652 | os.setEncoding( QTextStream::Latin1 ); | 1655 | os.setEncoding( Q3TextStream::Latin1 ); |
1653 | 1656 | ||
1654 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); | 1657 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); |
@@ -1659,5 +1662,5 @@ void KCommandSocket::readFile( QString fn ) | |||
1659 | { | 1662 | { |
1660 | if ( !mSocket ) { | 1663 | if ( !mSocket ) { |
1661 | mSocket = new QSocket( this ); | 1664 | mSocket = new Q3Socket( this ); |
1662 | //qDebug("KCS: read file - new socket"); | 1665 | //qDebug("KCS: read file - new socket"); |
1663 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); | 1666 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); |
@@ -1697,5 +1700,5 @@ void KCommandSocket::writeFile( QString fileName ) | |||
1697 | { | 1700 | { |
1698 | if ( !mSocket ) { | 1701 | if ( !mSocket ) { |
1699 | mSocket = new QSocket( this ); | 1702 | mSocket = new Q3Socket( this ); |
1700 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1703 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1701 | connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); | 1704 | connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); |
@@ -1710,10 +1713,10 @@ void KCommandSocket::writeFileToSocket() | |||
1710 | mTimerSocket->stop(); | 1713 | mTimerSocket->stop(); |
1711 | QFile file2( mFileName ); | 1714 | QFile file2( mFileName ); |
1712 | if (!file2.open( IO_ReadOnly ) ) { | 1715 | if (!file2.open( QIODevice::ReadOnly ) ) { |
1713 | mConnectProgress.hide(); | 1716 | mConnectProgress.hide(); |
1714 | mConnectCount = -1; | 1717 | mConnectCount = -1; |
1715 | mRetVal= errorW; | 1718 | mRetVal= errorW; |
1716 | mSocket->close(); | 1719 | mSocket->close(); |
1717 | if ( mSocket->state() == QSocket::Idle ) | 1720 | if ( mSocket->state() == Q3Socket::Idle ) |
1718 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1721 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1719 | return ; | 1722 | return ; |
@@ -1725,8 +1728,8 @@ void KCommandSocket::writeFileToSocket() | |||
1725 | mConnectProgress.setProgress( count ); | 1728 | mConnectProgress.setProgress( count ); |
1726 | mConnectProgress.blockSignals( true ); | 1729 | mConnectProgress.blockSignals( true ); |
1727 | QTextStream ts2( &file2 ); | 1730 | Q3TextStream ts2( &file2 ); |
1728 | ts2.setEncoding( QTextStream::Latin1 ); | 1731 | ts2.setEncoding( Q3TextStream::Latin1 ); |
1729 | QTextStream os2( mSocket ); | 1732 | Q3TextStream os2( mSocket ); |
1730 | os2.setEncoding( QTextStream::Latin1 ); | 1733 | os2.setEncoding( Q3TextStream::Latin1 ); |
1731 | os2 << "PUT " << mPassWord << " " << mRemoteResource << "\r\n\r\n";; | 1734 | os2 << "PUT " << mPassWord << " " << mRemoteResource << "\r\n\r\n";; |
1732 | int byteCount = 0; | 1735 | int byteCount = 0; |
@@ -1749,5 +1752,5 @@ void KCommandSocket::writeFileToSocket() | |||
1749 | mRetVal= successW; | 1752 | mRetVal= successW; |
1750 | mSocket->close(); | 1753 | mSocket->close(); |
1751 | if ( mSocket->state() == QSocket::Idle ) | 1754 | if ( mSocket->state() == Q3Socket::Idle ) |
1752 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1755 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1753 | mConnectProgress.blockSignals( false ); | 1756 | mConnectProgress.blockSignals( false ); |
@@ -1756,13 +1759,13 @@ void KCommandSocket::sendStop() | |||
1756 | { | 1759 | { |
1757 | if ( !mSocket ) { | 1760 | if ( !mSocket ) { |
1758 | mSocket = new QSocket( this ); | 1761 | mSocket = new Q3Socket( this ); |
1759 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1762 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1760 | } | 1763 | } |
1761 | mSocket->connectToHost( mHost, mPort ); | 1764 | mSocket->connectToHost( mHost, mPort ); |
1762 | QTextStream os2( mSocket ); | 1765 | Q3TextStream os2( mSocket ); |
1763 | os2.setEncoding( QTextStream::Latin1 ); | 1766 | os2.setEncoding( Q3TextStream::Latin1 ); |
1764 | os2 << "STOP\r\n\r\n"; | 1767 | os2 << "STOP\r\n\r\n"; |
1765 | mSocket->close(); | 1768 | mSocket->close(); |
1766 | if ( mSocket->state() == QSocket::Idle ) | 1769 | if ( mSocket->state() == Q3Socket::Idle ) |
1767 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1770 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1768 | } | 1771 | } |
@@ -1830,5 +1833,5 @@ void KCommandSocket::readFileFromSocket() | |||
1830 | QString fileName = mFileName; | 1833 | QString fileName = mFileName; |
1831 | QFile file ( fileName ); | 1834 | QFile file ( fileName ); |
1832 | if (!file.open( IO_WriteOnly ) ) { | 1835 | if (!file.open( QIODevice::WriteOnly ) ) { |
1833 | mFileString = ""; | 1836 | mFileString = ""; |
1834 | mRetVal = errorR; | 1837 | mRetVal = errorR; |
@@ -1839,6 +1842,6 @@ void KCommandSocket::readFileFromSocket() | |||
1839 | } | 1842 | } |
1840 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 1843 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
1841 | QTextStream ts ( &file ); | 1844 | Q3TextStream ts ( &file ); |
1842 | ts.setEncoding( QTextStream::Latin1 ); | 1845 | ts.setEncoding( Q3TextStream::Latin1 ); |
1843 | ts << mFileString; | 1846 | ts << mFileString; |
1844 | file.close(); | 1847 | file.close(); |
@@ -1848,5 +1851,5 @@ void KCommandSocket::readFileFromSocket() | |||
1848 | // if state is not idle, deleteSocket(); is called via | 1851 | // if state is not idle, deleteSocket(); is called via |
1849 | // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1852 | // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1850 | if ( mSocket->state() == QSocket::Idle ) | 1853 | if ( mSocket->state() == Q3Socket::Idle ) |
1851 | deleteSocket(); | 1854 | deleteSocket(); |
1852 | } | 1855 | } |