summaryrefslogtreecommitdiffabout
path: root/libkdepim/phoneaccess.cpp
Side-by-side diff
Diffstat (limited to 'libkdepim/phoneaccess.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/phoneaccess.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp
index 89db22b..0ea73f5 100644
--- a/libkdepim/phoneaccess.cpp
+++ b/libkdepim/phoneaccess.cpp
@@ -13,54 +13,57 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qstring.h>
#include <qapplication.h>
-#include <qptrlist.h>
+#include <QDesktopWidget>
+#include <q3ptrlist.h>
#include <qregexp.h>
#include <qfile.h>
#include <qlabel.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#include <qdir.h>
#include <kmessagebox.h>
#include <stdlib.h>
#include "phoneaccess.h"
void PhoneAccess::writeConfig( QString device, QString connection, QString model )
{
#ifdef _WIN32_
QString fileName = qApp->applicationDirPath () +"\\gammurc";
#else
QString fileName = QDir::homeDirPath() +"/.gammurc";
#endif
//qDebug("save %d ", load );
QString content = "[gammu]\n";;
bool write = false;
bool addPort = true, addConnection = true, addModel = true;
QFile file( fileName );
if ( QFile::exists( fileName) ) {
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
qDebug("Error: cannot open %s ", fileName.latin1() );
return;
}
QString line;
- while ( file.readLine( line, 1024 ) > 0 ) {
+ char tmp[1024];
+ while ( file.readLine( tmp, 1024 ) > 0 ) {
+ line = tmp;
//qDebug("*%s* ", line.latin1() );
if ( line.left(7 ) == "[gammu]" ) {
;
} else
if ( line.left(4 ) == "port" ) {
if ( line == "port = " + device+"\n" ) {
content += line ;
addPort = false;
//qDebug("port found" );
}
} else if ( line.left(5 ) == "model" ) {
@@ -106,30 +109,30 @@ void PhoneAccess::writeConfig( QString device, QString connection, QString model
content += "port = ";
content += device;
content += "\n";
}
if ( addModel ) {
write = true;
content += "model = ";
content += model;
content += "\n";
}
if ( write ) {
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
qDebug("Error: cannot write file %s ", fileName.latin1() );
return;
}
qDebug("Writing file %s ", fileName.latin1() );
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts << content ;
file.close();
}
}
bool PhoneAccess::writeToPhone( QString fileName)
{
#ifdef DESKTOP_VERSION
#ifdef _WIN32_