[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Candidate [PATCH] to kdeadmin/kpackage
From: "=?ISO-8859-1?Q?Arto_Hyt=F6nen?=" <amthpublic () gmail ! com>
Date: 2007-08-23 18:30:11
Message-ID: 79c5b0ba0708231130h78f2408br96c096db971accc () mail ! gmail ! com
[Download RAW message or body]
Back after three days of realFile(TM), and had time to look into
deprecated-- stuff again, and while after this patch the kpackage
still compiles and runs, as I don't have rpm/smart stuff installed, I
can't really check out the results, but as far as I get the format on
Qt includes, it should be quite correct, but would like that somebody
could verify the deprecated-- stuff as I want to be absolutely sure I
get the way stuff should be fixed the right way. :-)
Anyway, there are few places that I don't have a clue how to decipher
the Qt include hints on rewriting the calls, I would love if someone
could give me a leg up on those, so I can use the same understanding
to do other deprecated locations too...
Anyway, as usual the .diff is included.
--
amth
["kpackage.diff" (application/octet-stream)]
Index: kpackage/kpTerm.cpp
===================================================================
--- kpackage/kpTerm.cpp (revision 703800)
+++ kpackage/kpTerm.cpp (working copy)
@@ -113,14 +113,14 @@ void kpTerm::textIn(const QString &stext
QString del = "\010";
// kDebug() << "Tin=[" << stext << "]\n";
//` sleep(1);
- if (stext.find(chrs) < 0) {
+ if (stext.indexOf(chrs) < 0) {
// kDebug() << "T=[" << stext << "]\n";
insert( stext );
} else {
int p;
int op = 0;
- while ((p = stext.find(chrs,op)) >= 0) {
+ while ((p = stext.indexOf(chrs,op)) >= 0) {
if (p != op) {
insert( stext.mid(op, p-op));
// kDebug() << "B=[" << stext.mid(op, p-op) << "]\n";
Index: kpackage/packageInfo.cpp
===================================================================
--- kpackage/packageInfo.cpp (revision 703800)
+++ kpackage/packageInfo.cpp (working copy)
@@ -216,7 +216,7 @@ int packageInfo::getDigElement(const QSt
int val = 0;
if ((s[0] >= '0') && (s[0] <= '9')) {
- nf = s.find(ndig);
+ nf = s.indexOf(ndig);
if (nf >= 0) {
val = s.left(nf).toInt();
} else {
@@ -249,14 +249,14 @@ QString packageInfo::getNdigElement(cons
QRegExp idig("[0-9]");
if ((s[0] < '0') || (s[0] > '9') ) {
- nf = s.find(idig);
+ nf = s.indexOf(idig);
if (nf < 0)
nf = s.length();
str = s.left(nf);
for (int i = 0; i < str.length() ; i++) {
// Strange Debian package sorting magic
if (!str[i].isLetter()) {
- char t = str[i].latin1();
+ char t = str[i].toLatin1();
t += 128;
str[i] = t;
}
@@ -312,7 +312,7 @@ int packageInfo::pnewer(const QString &s
static bool split(QString orig, char separator, QString &first, QString &second)
{
- int pos = orig.find(separator);
+ int pos = orig.indexOf(separator);
if (pos > 0) {
first = orig.mid(0,pos);
second = orig.mid(pos+1);
@@ -414,7 +414,7 @@ KpTreeListItem *packageInfo::place(KpTre
qtmp = getInfo("group");
int cnt = 0;
- QStringList list = QStringList::split("/",qtmp);
+ QStringList list = qtmp.split("/");
// kDebug() << "Q=" << qtmp << "\n";
for (int i = 0; i < list.size(); ++i) {
KpTreeListItem *group;
@@ -443,7 +443,7 @@ KpTreeListItem *packageInfo::place(KpTre
QString sz = "";
if (hasInfo("size")) {
sz = info["size"].trimmed();
- sz = sz.rightJustify(6,' ');
+ sz = sz.rightJustified(6,' ');
}
QString ver = "";
@@ -518,7 +518,7 @@ bool packageInfo::smerge( const QString
for ( it = pi->info.begin(); it != pi->info.end(); ++it ) {
if (!(it.key() == "size" && !info["size"].isEmpty()) ||
!(it.key() == "file-size" && !info["file-size"].isEmpty())) {
- info.insert(it.key(), it.data());
+ info.insert(it.key(), it.data()); // what to do with this it.data()?
}
++it;
}
@@ -570,7 +570,7 @@ bool packageInfo::pkgInsert(QList<packag
shouldUpdate = false;
} else if (!installed) { // If older available package exists, remove it
kpackage->management->dirUninstPackages.take(*(pu->info.find("name")));
- pki.remove(pu);
+ pki.remove(pu); // what to do with this pki.remove(pu)?
}
}
}
@@ -604,8 +604,7 @@ bool packageInfo::pkgInsert(QList<packag
QString group = getInfo("group");
if (group == "NEW") {
if (pi->hasInfo("group")) {
- info.replace("group",
- pi->getInfo("group") );
+ info.insert("group", pi->getInfo("group") );
}
}
}
Index: kpackage/kpPty.cpp
===================================================================
--- kpackage/kpPty.cpp (revision 703800)
+++ kpackage/kpPty.cpp (working copy)
@@ -28,7 +28,6 @@
#include <qtimer.h>
#include <QRegExp>
//Added by qt3to4:
-#include <Q3CString>
#include <QTextCodec>
#include <k3processcontroller.h>
@@ -167,10 +166,10 @@ bool kpPty::startSession(bool needRoot)
pty->sstart(K3Process::NotifyOnExit);
RESTART:
- tm->start(6*1000, true);
+ tm->start(6*1000);
eventLoop = true;
kDebug() << "Loopst\n";
- kapp->enter_loop();
+ kapp->exec();
kDebug() << "Loopfn Result=" << Result << "\n";
tm->stop();
if (Result == TIMEOUT) { // timeout
@@ -225,7 +224,7 @@ bool kpPty::startSession(bool needRoot)
inSession = true;
kDebug() << "kpPty::startSession TRUE\n";
} else { // process return code
- pty->writeStdin(Q3CString("\04"), false); // SU doesn't listen to ^C
+ pty->writeStdin(QByteArray("\04"), false); // SU doesn't listen to ^C
if (interact) {
goto FULL_RESTART;
} else {
@@ -251,7 +250,7 @@ void kpPty::breakUpCmd(const QString &cm
bool quote = false;
QString s;
- QStringList cl = QStringList::split(" ", cmd);
+ QStringList cl = cmd.split(" ");
for ( QStringList::Iterator it = cl.begin(); it != cl.end(); ++it ) {
int lastPt = (*it).length() - 1;
@@ -316,7 +315,7 @@ QStringList kpPty::run(const QString &cm
if (inLoop) {
eventLoop = true;
- kapp->enter_loop();
+ kapp->exec();
return retList;
} else {
@@ -343,18 +342,18 @@ void kpPty::finish(int ret)
if (ret == PROMPT) { // Called program executed in session
if (!retList.empty()) {
- l = retList.fromLast();
+ l = retList.isEmpty() ? retList.end() : --retList.end();
if ((*l).right(2) == SHPROMPT) {
- retList.remove(l); // Remove prompt
+ retList.erase(l); // Remove prompt
}
}
if (!retList.empty()) {
int p;
- l = retList.fromLast();
- if ((p = (*l).find("RESULT=")) >= 0) {
+ l = retList.isEmpty() ? retList.end() : --retList.end();
+ if ((p = (*l).indexOf("RESULT=")) >= 0) {
ret = (*l).mid(p+7).toInt(0,10);
- retList.remove(l); // Remove return code
+ retList.erase(l); // Remove return code
} else {
ret = 666;
}
@@ -363,8 +362,8 @@ void kpPty::finish(int ret)
if (!retList.empty()) {
l = retList.begin();
if ( l != retList.end()) {
- if ((*l).find("RESULT=") >= 0) {
- retList.remove(l); // Remove command at start
+ if ((*l).indexOf("RESULT=") >= 0) {
+ retList.erase(l); // Remove command at start
}
}
}
@@ -374,7 +373,7 @@ void kpPty::finish(int ret)
if (eventLoop) {
eventLoop = false;
- kapp->exit_loop();
+ kapp->exit();
}
}
@@ -390,11 +389,12 @@ void kpPty::readLines()
emit textIn(stext, !unterm);
if (pUnterm) {
- QStringList::Iterator lst = retList.fromLast();
+ QStringList::Iterator lst;
+ lst = retList.isEmpty() ? retList.end() : --retList.end();
if (lst != retList.end())
{
stext = *lst + stext;
- retList.remove(lst);
+ retList.erase(lst);
}
}
@@ -407,7 +407,7 @@ void kpPty::readLines()
stext.truncate(stext.length()-1);
}
- i = stext.findRev('\r');
+ i = stext.lastIndexOf('\r');
if (i > -1) {
stext = stext.mid(i+1);
}
@@ -424,7 +424,7 @@ void kpPty::readLines()
finish(PROMPT);
} else if (loginSession) {
QRegExp rx( "^[^:]+:[\\s]*$"); // Password prompt
- if (rx.search(retList.last()) >= 0) {
+ if (rx.indexIn(retList.last()) >= 0) {
kDebug() << loginSession << " " <<retList.last()<< " Match password p\n";
finish(PASSWORD);
}
Index: kpackage/procbuf.cpp
===================================================================
--- kpackage/procbuf.cpp (revision 703800)
+++ kpackage/procbuf.cpp (working copy)
@@ -110,7 +110,7 @@ int procbuf::start (QString msg, bool e
int timeout, QString timeMsg )
{
if (timeout) {
- tm->start(timeout*1000, true);
+ tm->start(timeout*1000);
timed = true;
}
Index: kpackage/debInterface.cpp
===================================================================
--- kpackage/debInterface.cpp (revision 703800)
+++ kpackage/debInterface.cpp (working copy)
@@ -151,7 +151,7 @@ packageInfo *DEB::getFPackageInfo( const
if ((*it).indexOf("Package:") >= 0) {
// kDebug() << "found\n";
while (it != list.begin()) {
- list.remove(list.begin());
+ list.erase(list.begin());
}
break;
}
@@ -288,7 +288,7 @@ QStringList DEB::FindFile(const QString
if (filelist.count() == 1) {
QStringList::Iterator it = filelist.begin();
if ((*it).indexOf("not found") >= 0) {
- filelist.remove(it);
+ filelist.erase(it);
}
}
Index: kpackage/kpPty.h
===================================================================
--- kpackage/kpPty.h (revision 703800)
+++ kpackage/kpPty.h (working copy)
@@ -28,13 +28,11 @@
#define KPPTY_H
#include <q3multilineedit.h>
-#include <qstringlist.h>
+#include <QtCore/QStringList>
#include <QRegExp>
#include <qtextcodec.h>
#include <QMap>
//Added by qt3to4:
-#include <Q3CString>
-
#include <k3procio.h>
//////////////////////////////////////////////////////////////////////////////
Index: kpackage/packageDisplay.cpp
===================================================================
--- kpackage/packageDisplay.cpp (revision 703800)
+++ kpackage/packageDisplay.cpp (working copy)
@@ -281,7 +281,7 @@ void packageDisplayWidget::updateChangeL
lines = package->interface->getChangeLog(package);
- changeLog->setTextFormat(Qt::LogText);
+ changeLog->setTextFormat(Qt::LogText); // what to do with this setTextFormat()?
changeLog->hide();
if (lines.count() > 1) {
changeLog->setText("");
@@ -392,7 +392,7 @@ void packageDisplayWidget::updateFileLis
this, SLOT( openContext(K3ListView *, Q3ListViewItem *, const QPoint \
&)) );
FileListMenu = new KMenu();
- openwith = FileListMenu->insertItem(i18n("&Open \
With..."),parent2,SLOT(__openBindingWith())); + openwith = \
FileListMenu->insertItem(i18n("&Open With..."),parent2,SLOT(__openBindingWith())); // \
what to do with this insertItem()?
pkDisplay = parent2;
}
@@ -416,7 +416,7 @@ void packageDisplayWidget::updateFileLis
void kpFileList::openContext(K3ListView *, Q3ListViewItem *, const QPoint &p)
{
- FileListMenu->setItemEnabled(openwith,
+ FileListMenu->setItemEnabled(openwith, // what to do with this \
setItemEnabled()?
(selectedItem() && pkDisplay->package && \
pkDisplay->package->getFilename().isEmpty()) ? true : false); FileListMenu->exec(p);
}
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic