summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/csv.cpp
Side-by-side diff
Diffstat (limited to 'pwmanager/pwmanager/csv.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/csv.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/pwmanager/pwmanager/csv.cpp b/pwmanager/pwmanager/csv.cpp
index 194edf2..226cc08 100644
--- a/pwmanager/pwmanager/csv.cpp
+++ b/pwmanager/pwmanager/csv.cpp
@@ -23,6 +23,8 @@
#include <kmessagebox.h>
#include <klocale.h>
+//Added by qt3to4:
+#include <Q3CString>
#define MAX_CSV_FILE_SIZE (50 * 1024 * 1024) // bytes
@@ -42,7 +44,7 @@ bool Csv::importData(const QString &filepath,
bool ret = true;
QByteArray d;
QFile f(filepath);
- if (!f.open(IO_ReadOnly)) {
+ if (!f.open(QIODevice::ReadOnly)) {
KMessageBox::error(parent,
i18n("Could not open file.\n"
"Does the file exist?"),
@@ -89,7 +91,7 @@ bool Csv::doImport(const QByteArray &d,
int refIndex = 0;
int ret;
- QCString s, curCat;
+ Q3CString s, curCat;
int fieldIndex = 0;
bool inRecord = false;
/* fieldIndex is a reference count to see which
@@ -121,27 +123,27 @@ bool Csv::doImport(const QByteArray &d,
curCat = s;
break;
case 1: // desc
- di.desc = s;
+ di.desc = std::string(s);
++fieldIndex;
break;
case 2: // name
- di.name = s;
+ di.name = std::string(s);
++fieldIndex;
break;
case 3: // pw
- di.pw = s;
+ di.pw = std::string(s);
++fieldIndex;
break;
case 4: // url
- di.url = s;
+ di.url = std::string(s);
++fieldIndex;
break;
case 5: // launcher
- di.launcher = s;
+ di.launcher = std::string(s);
++fieldIndex;
break;
case 6: // comment
- di.comment = s;
+ di.comment = std::string(s);
++fieldIndex;
break;
default:
@@ -154,7 +156,7 @@ bool Csv::doImport(const QByteArray &d,
case 1:
// record complete.
if (fieldIndex == 6)
- di.comment = s;
+ di.comment = std::string(s);
inRecord = false;
fieldIndex = 0;
doc->addEntry(curCat, &di, true);
@@ -175,7 +177,7 @@ bool Csv::doImport(const QByteArray &d,
return false;
}
-int Csv::nextField(QCString *ret,
+int Csv::nextField(Q3CString *ret,
const QByteArray &in,
bool inRecord,
int *_refIndex)
@@ -353,7 +355,7 @@ bool Csv::exportData(const QString &filepath,
}
}
QFile f(filepath);
- if (!f.open(IO_ReadWrite)) {
+ if (!f.open(QIODevice::ReadWrite)) {
KMessageBox::error(parent,
i18n("Could not open file for writing."),
i18n("Open error."));
@@ -376,7 +378,7 @@ bool Csv::doExport(QFile &f,
unsigned int numEntr;
unsigned int i, j;
PwMDataItem d;
- QCString s, catName;
+ Q3CString s, catName;
QByteArray b;
for (i = 0; i < numCat; ++i) {
@@ -401,7 +403,7 @@ bool Csv::doExport(QFile &f,
b = s;
// remove \0 termination
#ifndef PWM_EMBEDDED
- b.resize(b.size() - 1, QGArray::SpeedOptim);
+ b.resize(b.size() - 1, Q3GArray::SpeedOptim);
#else
b.resize(b.size() - 1);
#endif
@@ -412,15 +414,15 @@ bool Csv::doExport(QFile &f,
return true;
}
-QCString Csv::newField(QCString s)
+Q3CString Csv::newField(Q3CString s)
{
if (s.isEmpty())
- return QCString();
- QCString ret("\"");
+ return Q3CString();
+ Q3CString ret("\"");
#ifndef PWM_EMBEDDED
s.replace('\"', "\"\"");
#else
- s.replace(QRegExp("\""), "\"\"");
+ s.replace("\"", "\"\"");
#endif
ret += s;
ret += "\"";