author | zautrix <zautrix> | 2004-10-07 13:22:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-07 13:22:40 (UTC) |
commit | d14d61ebb2e41329465883a0dfce719d69fc3f3e (patch) (unidiff) | |
tree | 39330d3848e530f9ba8deac4086685674acdc839 /libkdepim/ksyncmanager.cpp | |
parent | 826dc960353e47a60aba13916189c45ef3392c1e (diff) | |
download | kdepimpi-d14d61ebb2e41329465883a0dfce719d69fc3f3e.zip kdepimpi-d14d61ebb2e41329465883a0dfce719d69fc3f3e.tar.gz kdepimpi-d14d61ebb2e41329465883a0dfce719d69fc3f3e.tar.bz2 |
utf8 fixes
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index a663427..28af135 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -925,28 +925,28 @@ void KServerSocket::send_file() | |||
925 | if (!file.open( IO_ReadOnly ) ) { | 925 | if (!file.open( IO_ReadOnly ) ) { |
926 | delete mSyncActionDialog; | 926 | delete mSyncActionDialog; |
927 | mSyncActionDialog = 0; | 927 | mSyncActionDialog = 0; |
928 | qDebug("KSS::error open file "); | 928 | qDebug("KSS::error open file "); |
929 | mSocket->close(); | 929 | mSocket->close(); |
930 | if ( mSocket->state() == QSocket::Idle ) | 930 | if ( mSocket->state() == QSocket::Idle ) |
931 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 931 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
932 | return ; | 932 | return ; |
933 | 933 | ||
934 | } | 934 | } |
935 | mSyncActionDialog->setCaption( i18n("Sending file...") ); | 935 | mSyncActionDialog->setCaption( i18n("Sending file...") ); |
936 | QTextStream ts( &file ); | 936 | QTextStream ts( &file ); |
937 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 937 | ts.setEncoding( QTextStream::Latin1 ); |
938 | |||
938 | QTextStream os( mSocket ); | 939 | QTextStream os( mSocket ); |
939 | os.setCodec( QTextCodec::codecForName("utf8") ); | 940 | os.setEncoding( QTextStream::Latin1 ); |
940 | //os.setEncoding( QTextStream::UnicodeUTF8 ); | ||
941 | while ( ! ts.atEnd() ) { | 941 | while ( ! ts.atEnd() ) { |
942 | os << ts.readLine() << "\n"; | 942 | os << ts.readLine() << "\n"; |
943 | } | 943 | } |
944 | //os << ts.read(); | 944 | //os << ts.read(); |
945 | file.close(); | 945 | file.close(); |
946 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); | 946 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); |
947 | mSocket->close(); | 947 | mSocket->close(); |
948 | if ( mSocket->state() == QSocket::Idle ) | 948 | if ( mSocket->state() == QSocket::Idle ) |
949 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 949 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
950 | } | 950 | } |
951 | void KServerSocket::get_file() | 951 | void KServerSocket::get_file() |
952 | { | 952 | { |
@@ -981,25 +981,25 @@ void KServerSocket::readBackFileFromSocket() | |||
981 | delete mSyncActionDialog; | 981 | delete mSyncActionDialog; |
982 | mSyncActionDialog = 0; | 982 | mSyncActionDialog = 0; |
983 | qDebug("error open cal file "); | 983 | qDebug("error open cal file "); |
984 | piFileString = ""; | 984 | piFileString = ""; |
985 | emit file_received( false ); | 985 | emit file_received( false ); |
986 | blockRC = false; | 986 | blockRC = false; |
987 | return ; | 987 | return ; |
988 | 988 | ||
989 | } | 989 | } |
990 | 990 | ||
991 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 991 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
992 | QTextStream ts ( &file ); | 992 | QTextStream ts ( &file ); |
993 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 993 | ts.setEncoding( QTextStream::Latin1 ); |
994 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); | 994 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); |
995 | ts << piFileString; | 995 | ts << piFileString; |
996 | mSocket->close(); | 996 | mSocket->close(); |
997 | if ( mSocket->state() == QSocket::Idle ) | 997 | if ( mSocket->state() == QSocket::Idle ) |
998 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 998 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
999 | file.close(); | 999 | file.close(); |
1000 | delete mSyncActionDialog; | 1000 | delete mSyncActionDialog; |
1001 | mSyncActionDialog = 0; | 1001 | mSyncActionDialog = 0; |
1002 | piFileString = ""; | 1002 | piFileString = ""; |
1003 | blockRC = false; | 1003 | blockRC = false; |
1004 | emit file_received( true ); | 1004 | emit file_received( true ); |
1005 | 1005 | ||
@@ -1019,25 +1019,25 @@ KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, | |||
1019 | void KCommandSocket::readFile( QString fn ) | 1019 | void KCommandSocket::readFile( QString fn ) |
1020 | { | 1020 | { |
1021 | if ( !mSocket ) { | 1021 | if ( !mSocket ) { |
1022 | mSocket = new QSocket( this ); | 1022 | mSocket = new QSocket( this ); |
1023 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); | 1023 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); |
1024 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1024 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1025 | } | 1025 | } |
1026 | mFileString = ""; | 1026 | mFileString = ""; |
1027 | mFileName = fn; | 1027 | mFileName = fn; |
1028 | mFirst = true; | 1028 | mFirst = true; |
1029 | mSocket->connectToHost( mHost, mPort ); | 1029 | mSocket->connectToHost( mHost, mPort ); |
1030 | QTextStream os( mSocket ); | 1030 | QTextStream os( mSocket ); |
1031 | os.setEncoding( QTextStream::UnicodeUTF8 ); | 1031 | os.setEncoding( QTextStream::Latin1 ); |
1032 | os << "GET " << mPassWord << "\r\n"; | 1032 | os << "GET " << mPassWord << "\r\n"; |
1033 | mTimerSocket->start( 10000 ); | 1033 | mTimerSocket->start( 10000 ); |
1034 | } | 1034 | } |
1035 | 1035 | ||
1036 | void KCommandSocket::writeFile( QString fileName ) | 1036 | void KCommandSocket::writeFile( QString fileName ) |
1037 | { | 1037 | { |
1038 | if ( !mSocket ) { | 1038 | if ( !mSocket ) { |
1039 | mSocket = new QSocket( this ); | 1039 | mSocket = new QSocket( this ); |
1040 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1040 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1041 | connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); | 1041 | connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); |
1042 | } | 1042 | } |
1043 | mFileName = fileName ; | 1043 | mFileName = fileName ; |
@@ -1045,46 +1045,46 @@ void KCommandSocket::writeFile( QString fileName ) | |||
1045 | } | 1045 | } |
1046 | void KCommandSocket::writeFileToSocket() | 1046 | void KCommandSocket::writeFileToSocket() |
1047 | { | 1047 | { |
1048 | QFile file2( mFileName ); | 1048 | QFile file2( mFileName ); |
1049 | if (!file2.open( IO_ReadOnly ) ) { | 1049 | if (!file2.open( IO_ReadOnly ) ) { |
1050 | mRetVal= errorW; | 1050 | mRetVal= errorW; |
1051 | mSocket->close(); | 1051 | mSocket->close(); |
1052 | if ( mSocket->state() == QSocket::Idle ) | 1052 | if ( mSocket->state() == QSocket::Idle ) |
1053 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1053 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1054 | return ; | 1054 | return ; |
1055 | } | 1055 | } |
1056 | QTextStream ts2( &file2 ); | 1056 | QTextStream ts2( &file2 ); |
1057 | ts2.setCodec( QTextCodec::codecForName("utf8") ); | 1057 | ts2.setEncoding( QTextStream::Latin1 ); |
1058 | QTextStream os2( mSocket ); | 1058 | QTextStream os2( mSocket ); |
1059 | os2.setCodec( QTextCodec::codecForName("utf8") ); | 1059 | os2.setEncoding( QTextStream::Latin1 ); |
1060 | os2 << "PUT " << mPassWord << "\r\n";; | 1060 | os2 << "PUT " << mPassWord << "\r\n";; |
1061 | while ( ! ts2.atEnd() ) { | 1061 | while ( ! ts2.atEnd() ) { |
1062 | os2 << ts2.readLine() << "\n"; | 1062 | os2 << ts2.readLine() << "\n"; |
1063 | } | 1063 | } |
1064 | mRetVal= successW; | 1064 | mRetVal= successW; |
1065 | file2.close(); | 1065 | file2.close(); |
1066 | mSocket->close(); | 1066 | mSocket->close(); |
1067 | if ( mSocket->state() == QSocket::Idle ) | 1067 | if ( mSocket->state() == QSocket::Idle ) |
1068 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1068 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1069 | } | 1069 | } |
1070 | void KCommandSocket::sendStop() | 1070 | void KCommandSocket::sendStop() |
1071 | { | 1071 | { |
1072 | if ( !mSocket ) { | 1072 | if ( !mSocket ) { |
1073 | mSocket = new QSocket( this ); | 1073 | mSocket = new QSocket( this ); |
1074 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1074 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1075 | } | 1075 | } |
1076 | mSocket->connectToHost( mHost, mPort ); | 1076 | mSocket->connectToHost( mHost, mPort ); |
1077 | QTextStream os2( mSocket ); | 1077 | QTextStream os2( mSocket ); |
1078 | os2.setCodec( QTextCodec::codecForName("utf8") ); | 1078 | os2.setEncoding( QTextStream::Latin1 ); |
1079 | os2 << "STOP\r\n"; | 1079 | os2 << "STOP\r\n"; |
1080 | mSocket->close(); | 1080 | mSocket->close(); |
1081 | if ( mSocket->state() == QSocket::Idle ) | 1081 | if ( mSocket->state() == QSocket::Idle ) |
1082 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1082 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | void KCommandSocket::startReadFileFromSocket() | 1085 | void KCommandSocket::startReadFileFromSocket() |
1086 | { | 1086 | { |
1087 | if ( ! mFirst ) | 1087 | if ( ! mFirst ) |
1088 | return; | 1088 | return; |
1089 | mFirst = false; | 1089 | mFirst = false; |
1090 | mTimerSocket->stop(); | 1090 | mTimerSocket->stop(); |
@@ -1111,25 +1111,25 @@ void KCommandSocket::readFileFromSocket() | |||
1111 | QString fileName = mFileName; | 1111 | QString fileName = mFileName; |
1112 | QFile file ( fileName ); | 1112 | QFile file ( fileName ); |
1113 | if (!file.open( IO_WriteOnly ) ) { | 1113 | if (!file.open( IO_WriteOnly ) ) { |
1114 | mFileString = ""; | 1114 | mFileString = ""; |
1115 | mRetVal = errorR; | 1115 | mRetVal = errorR; |
1116 | qDebug("Error open temp calender file for writing: %s",fileName.latin1() ); | 1116 | qDebug("Error open temp calender file for writing: %s",fileName.latin1() ); |
1117 | deleteSocket(); | 1117 | deleteSocket(); |
1118 | return ; | 1118 | return ; |
1119 | 1119 | ||
1120 | } | 1120 | } |
1121 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 1121 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
1122 | QTextStream ts ( &file ); | 1122 | QTextStream ts ( &file ); |
1123 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 1123 | ts.setEncoding( QTextStream::Latin1 ); |
1124 | ts << mFileString; | 1124 | ts << mFileString; |
1125 | file.close(); | 1125 | file.close(); |
1126 | mFileString = ""; | 1126 | mFileString = ""; |
1127 | mRetVal = successR; | 1127 | mRetVal = successR; |
1128 | mSocket->close(); | 1128 | mSocket->close(); |
1129 | // if state is not idle, deleteSocket(); is called via | 1129 | // if state is not idle, deleteSocket(); is called via |
1130 | // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1130 | // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1131 | if ( mSocket->state() == QSocket::Idle ) | 1131 | if ( mSocket->state() == QSocket::Idle ) |
1132 | deleteSocket(); | 1132 | deleteSocket(); |
1133 | } | 1133 | } |
1134 | 1134 | ||
1135 | void KCommandSocket::deleteSocket() | 1135 | void KCommandSocket::deleteSocket() |