summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncmanager.cpp
Side-by-side diff
Diffstat (limited to 'libkdepim/ksyncmanager.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp97
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
@@ -35,11 +35,11 @@
#include <kmessagebox.h>
#include <qdir.h>
-#include <qprogressbar.h>
-#include <qpopupmenu.h>
+#include <q3progressbar.h>
+#include <q3popupmenu.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <qtimer.h>
#include <qmessagebox.h>
#include <qapplication.h>
@@ -50,6 +50,9 @@
#include <qlabel.h>
#include <qcheckbox.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#include <klocale.h>
#include <kglobal.h>
@@ -59,11 +62,11 @@
QDateTime KSyncManager::mRequestedSyncEvent;
-KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
+KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, Q3PopupMenu* syncmenu)
: QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu)
{
mServerSocket = 0;
- bar = new QProgressBar ( 1, 0 );
+ bar = new Q3ProgressBar ( 1, 0 );
bar->setCaption ("");
mWriteBackInPast = 2;
@@ -89,7 +92,7 @@ void KSyncManager::fillSyncMenu()
mSyncMenu->insertItem( i18n("Configure..."), 0 );
mSyncMenu->insertSeparator();
- QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu );
+ Q3PopupMenu *clearMenu = new Q3PopupMenu ( mSyncMenu );
mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 );
clearMenu->insertItem( i18n("For all profiles"), 1 );
clearMenu->insertSeparator();
@@ -355,7 +358,7 @@ void KSyncManager::enableQuick( bool ask )
if ( ask ) {
QDialog dia ( 0, "input-dialog", true );
QLineEdit lab ( &dia );
- QVBoxLayout lay( &dia );
+ Q3VBoxLayout lay( &dia );
lab.setText( mPrefs->mPassiveSyncPort );
lay.setMargin(7);
lay.setSpacing(7);
@@ -804,7 +807,7 @@ bool KSyncManager::edit_pisync_options()
{
QDialog dia( mParent, "dia", true );
dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice );
- QVBoxLayout lay ( &dia );
+ Q3VBoxLayout lay ( &dia );
lay.setSpacing( 5 );
lay.setMargin( 3 );
QLabel lab1 ( i18n("Password for remote access:"), &dia);
@@ -838,8 +841,8 @@ bool KSyncManager::edit_sync_options()
QDialog dia( mParent, "dia", true );
dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
- QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
- QVBoxLayout lay ( &dia );
+ Q3ButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
+ Q3VBoxLayout lay ( &dia );
lay.setSpacing( 2 );
lay.setMargin( 3 );
lay.addWidget(&gr);
@@ -891,7 +894,7 @@ QString KSyncManager::getPassword( )
QDialog dia ( mParent, "input-dialog", true );
QLineEdit lab ( &dia );
lab.setEchoMode( QLineEdit::Password );
- QVBoxLayout lay( &dia );
+ Q3VBoxLayout lay( &dia );
lay.setMargin(7);
lay.setSpacing(7);
lay.addWidget( &lab);
@@ -1334,7 +1337,7 @@ void KSyncManager::readFileFromSocket()
}
}
-KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name )
+KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : Q3ServerSocket( port, backlog, parent, name )
{
mPendingConnect = 0;
mPassWord = pw;
@@ -1350,7 +1353,7 @@ void KServerSocket::waitForSocketFinish()
QTimer::singleShot( 250, this , SLOT ( waitForSocketFinish()));
return;
}
- mSocket = new QSocket( this );
+ mSocket = new Q3Socket( this );
connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
mSocket->setSocket( mPendingConnect );
@@ -1372,7 +1375,7 @@ void KServerSocket::newConnection ( int socket )
mSocket = 0;
}
mPendingConnect = 0;
- mSocket = new QSocket( this );
+ mSocket = new Q3Socket( this );
connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
mSocket->setSocket( socket );
@@ -1462,11 +1465,11 @@ void KServerSocket::displayErrorMessage()
}
void KServerSocket::error_connect( QString errmess )
{
- QTextStream os( mSocket );
- os.setEncoding( QTextStream::Latin1 );
+ Q3TextStream os( mSocket );
+ os.setEncoding( Q3TextStream::Latin1 );
os << errmess ;
mSocket->close();
- if ( mSocket->state() == QSocket::Idle ) {
+ if ( mSocket->state() == Q3Socket::Idle ) {
QTimer::singleShot( 0, this , SLOT ( discardClient()));
}
}
@@ -1484,7 +1487,7 @@ void KServerSocket::send_file()
mSyncActionDialog->setCaption(i18n("Received sync request"));
QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog );
label->setAlignment ( Qt::AlignHCenter );
- QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( mSyncActionDialog );
lay->addWidget( label);
lay->setMargin(7);
lay->setSpacing(7);
@@ -1536,18 +1539,18 @@ void KServerSocket::send_file()
qApp->processEvents();
QString fileName = mFileName;
QFile file( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
mErrorMessage = 0;
end_connect();
error_connect("ERROR_FI\r\n\r\n");
return ;
}
mSyncActionDialog->setCaption( i18n("Sending file...") );
- QTextStream ts( &file );
- ts.setEncoding( QTextStream::Latin1 );
+ Q3TextStream ts( &file );
+ ts.setEncoding( Q3TextStream::Latin1 );
- QTextStream os( mSocket );
- os.setEncoding( QTextStream::Latin1 );
+ Q3TextStream os( mSocket );
+ os.setEncoding( Q3TextStream::Latin1 );
while ( ! ts.atEnd() ) {
os << ts.readLine() << "\r\n";
}
@@ -1556,7 +1559,7 @@ void KServerSocket::send_file()
file.close();
mSyncActionDialog->setCaption( i18n("Waiting for synced file...") );
mSocket->close();
- if ( mSocket->state() == QSocket::Idle )
+ if ( mSocket->state() == Q3Socket::Idle )
QTimer::singleShot( 10, this , SLOT ( discardClient()));
}
void KServerSocket::get_file()
@@ -1588,7 +1591,7 @@ void KServerSocket::readBackFileFromSocket()
}
QString fileName = mFileName;
QFile file ( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
delete mSyncActionDialog;
mSyncActionDialog = 0;
qDebug("KSS:Error open read back file ");
@@ -1601,12 +1604,12 @@ void KServerSocket::readBackFileFromSocket()
}
// mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
- QTextStream ts ( &file );
- ts.setEncoding( QTextStream::Latin1 );
+ Q3TextStream ts ( &file );
+ ts.setEncoding( Q3TextStream::Latin1 );
mSyncActionDialog->setCaption( i18n("Writing file to disk...") );
ts << piFileString;
mSocket->close();
- if ( mSocket->state() == QSocket::Idle )
+ if ( mSocket->state() == Q3Socket::Idle )
QTimer::singleShot( 10, this , SLOT ( discardClient()));
file.close();
piFileString = "";
@@ -1648,8 +1651,8 @@ void KCommandSocket::sendFileRequest()
mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") );
mConnectProgress.setLabelText( i18n("Waiting for remote file...") );
mTimerSocket->start( 100, true );
- QTextStream os( mSocket );
- os.setEncoding( QTextStream::Latin1 );
+ Q3TextStream os( mSocket );
+ os.setEncoding( Q3TextStream::Latin1 );
QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate );
os << "GET " << mPassWord << curDt << " " << mRemoteResource << "\r\n\r\n";
@@ -1658,7 +1661,7 @@ void KCommandSocket::sendFileRequest()
void KCommandSocket::readFile( QString fn )
{
if ( !mSocket ) {
- mSocket = new QSocket( this );
+ mSocket = new Q3Socket( this );
//qDebug("KCS: read file - new socket");
connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) );
connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
@@ -1696,7 +1699,7 @@ void KCommandSocket::updateConnectDialog()
void KCommandSocket::writeFile( QString fileName )
{
if ( !mSocket ) {
- mSocket = new QSocket( this );
+ mSocket = new Q3Socket( this );
connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) );
}
@@ -1709,12 +1712,12 @@ void KCommandSocket::writeFileToSocket()
{
mTimerSocket->stop();
QFile file2( mFileName );
- if (!file2.open( IO_ReadOnly ) ) {
+ if (!file2.open( QIODevice::ReadOnly ) ) {
mConnectProgress.hide();
mConnectCount = -1;
mRetVal= errorW;
mSocket->close();
- if ( mSocket->state() == QSocket::Idle )
+ if ( mSocket->state() == Q3Socket::Idle )
QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
return ;
}
@@ -1724,10 +1727,10 @@ void KCommandSocket::writeFileToSocket()
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 );
+ Q3TextStream ts2( &file2 );
+ ts2.setEncoding( Q3TextStream::Latin1 );
+ Q3TextStream os2( mSocket );
+ os2.setEncoding( Q3TextStream::Latin1 );
os2 << "PUT " << mPassWord << " " << mRemoteResource << "\r\n\r\n";;
int byteCount = 0;
int byteMax = file2.size()/53;
@@ -1748,22 +1751,22 @@ void KCommandSocket::writeFileToSocket()
os2 << "\r\n";
mRetVal= successW;
mSocket->close();
- if ( mSocket->state() == QSocket::Idle )
+ if ( mSocket->state() == Q3Socket::Idle )
QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
mConnectProgress.blockSignals( false );
}
void KCommandSocket::sendStop()
{
if ( !mSocket ) {
- mSocket = new QSocket( this );
+ mSocket = new Q3Socket( this );
connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
}
mSocket->connectToHost( mHost, mPort );
- QTextStream os2( mSocket );
- os2.setEncoding( QTextStream::Latin1 );
+ Q3TextStream os2( mSocket );
+ os2.setEncoding( Q3TextStream::Latin1 );
os2 << "STOP\r\n\r\n";
mSocket->close();
- if ( mSocket->state() == QSocket::Idle )
+ if ( mSocket->state() == Q3Socket::Idle )
QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
}
@@ -1829,7 +1832,7 @@ void KCommandSocket::readFileFromSocket()
mConnectProgress.hide();
QString fileName = mFileName;
QFile file ( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
mFileString = "";
mRetVal = errorR;
qDebug("KSS:Error open temp sync file for writing: %s",fileName.latin1() );
@@ -1838,8 +1841,8 @@ void KCommandSocket::readFileFromSocket()
}
// mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
- QTextStream ts ( &file );
- ts.setEncoding( QTextStream::Latin1 );
+ Q3TextStream ts ( &file );
+ ts.setEncoding( Q3TextStream::Latin1 );
ts << mFileString;
file.close();
mFileString = "";
@@ -1847,7 +1850,7 @@ void KCommandSocket::readFileFromSocket()
mSocket->close();
// if state is not idle, deleteSocket(); is called via
// connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
- if ( mSocket->state() == QSocket::Idle )
+ if ( mSocket->state() == Q3Socket::Idle )
deleteSocket();
}