diff options
| author | Mavridis Philippe <mavridisf@gmail.com> | 2024-08-09 14:49:43 +0300 |
|---|---|---|
| committer | Mavridis Philippe <mavridisf@gmail.com> | 2024-08-09 14:49:43 +0300 |
| commit | 2fbdf2c0982e3e2147774c2034c21aebb67f732d (patch) | |
| tree | 9a40eed04425f26d1b3e2adea3f4b091299b84d3 /src/altparser.cpp | |
| parent | 47becbedc6788937ab25df5220f0bf25291b62e8 (diff) | |
| download | tdealternatives-2fbdf2c0982e3e2147774c2034c21aebb67f732d.tar.gz tdealternatives-2fbdf2c0982e3e2147774c2034c21aebb67f732d.zip | |
Qt3->TQt port
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'src/altparser.cpp')
| -rw-r--r-- | src/altparser.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/src/altparser.cpp b/src/altparser.cpp index bb31d88..f311316 100644 --- a/src/altparser.cpp +++ b/src/altparser.cpp @@ -19,10 +19,10 @@ ***************************************************************************/ #include "altparser.h" -#include <qfileinfo.h> -#include <qfile.h> -#include <qdir.h> -#include <qstringlist.h> +#include <tqfileinfo.h> +#include <tqfile.h> +#include <tqdir.h> +#include <tqstringlist.h> #include <unistd.h> #include <string.h> @@ -31,7 +31,7 @@ Alternative::Alternative(Item *parentarg) : m_parent(parentarg) { m_priority = 1; - m_altSlaves = new QStringList; + m_altSlaves = new TQStringList; } // Copy constructor @@ -40,7 +40,7 @@ Alternative::Alternative(const Alternative &alt) : m_priority(alt.getPriority()), m_parent(alt.getParent()) { - m_altSlaves = new QStringList( *(alt.m_altSlaves) ); + m_altSlaves = new TQStringList( *(alt.m_altSlaves) ); } Alternative::~Alternative() @@ -56,12 +56,12 @@ Alternative& Alternative::operator=(const Alternative &alt) m_altPath = alt.getPath(); m_priority = alt.getPriority(); m_parent = alt.getParent(); - m_altSlaves = new QStringList( *(alt.m_altSlaves) ); + m_altSlaves = new TQStringList( *(alt.m_altSlaves) ); } return (*this); } -void Alternative::setSlaves(QStringList *slaves) +void Alternative::setSlaves(TQStringList *slaves) { if(m_altSlaves) delete m_altSlaves; m_altSlaves = slaves; @@ -70,7 +70,7 @@ void Alternative::setSlaves(QStringList *slaves) bool Alternative::isSelected() const { if(m_parent->isBroken()) return false; - QFileInfo file("/etc/alternatives/"+m_parent->getName()); + TQFileInfo file("/etc/alternatives/"+m_parent->getName()); if(!file.isSymLink()) return false; if(file.readLink() == m_altPath) return 1; return 0; @@ -79,7 +79,7 @@ bool Alternative::isSelected() const bool Alternative::isBroken() const { - return !QFile::exists(m_altPath); + return !TQFile::exists(m_altPath); } bool Alternative::select() @@ -88,23 +88,23 @@ bool Alternative::select() if(isSelected()) return true; if(isBroken()) { - m_selectError = QString("Broken alternative: Unexisting path %1").arg(m_altPath); + m_selectError = TQString("Broken alternative: Unexisting path %1").arg(m_altPath); return false; } // Remove the current link: - QString parentPath = QString("/etc/alternatives/%1").arg(m_parent->getName()); - QFile origlink(parentPath); + TQString parentPath = TQString("/etc/alternatives/%1").arg(m_parent->getName()); + TQFile origlink(parentPath); if(!origlink.remove()) { - m_selectError = QString("Could not delete alternative link %1: %2").arg(parentPath).arg(origlink.errorString()); + m_selectError = TQString("Could not delete alternative link %1: %2").arg(parentPath).arg(origlink.errorString()); return false; } // Then we do the main link: if(symlink(m_altPath.ascii(), parentPath.ascii()) == -1) { - m_selectError = QString(strerror(errno)); + m_selectError = TQString(strerror(errno)); return false; } @@ -113,21 +113,21 @@ bool Alternative::select() parslaves->setAutoDelete(1); if(parslaves->count() == 0 || m_altSlaves->count() == 0) return true; int count = 0; - QStringList::iterator sl; + TQStringList::iterator sl; Slave *parsl; for( sl = m_altSlaves->begin(); sl != m_altSlaves->end(); ++sl) { parsl = parslaves->at(count); - QString parstr = QString("/etc/alternatives/%1").arg(parsl->slname); - QFile parlink(parstr); + TQString parstr = TQString("/etc/alternatives/%1").arg(parsl->slname); + TQFile parlink(parstr); if(!parlink.remove()) { - m_selectError = QString("Could not delete slave alternative link %1: %2").arg(parstr).arg(parlink.errorString()); + m_selectError = TQString("Could not delete slave alternative link %1: %2").arg(parstr).arg(parlink.errorString()); return false; } if(symlink( (*sl).ascii(), parstr.ascii()) == -1) { - m_selectError = QString(strerror(errno)); + m_selectError = TQString(strerror(errno)); return false; } ++count; @@ -239,7 +239,7 @@ void Item::setSlaves(SlaveList *slaves) this->m_itemSlaves = slaves; } -void Item::addSlave(const QString &namearg, const QString &patharg) +void Item::addSlave(const TQString &namearg, const TQString &patharg) { Slave *s = new Slave; s->slname = namearg; @@ -247,9 +247,9 @@ void Item::addSlave(const QString &namearg, const QString &patharg) m_itemSlaves->append(s); } -void Item::delSlave(const QString &namearg) +void Item::delSlave(const TQString &namearg) { - QPtrListIterator<Slave> it(*m_itemSlaves); + TQPtrListIterator<Slave> it(*m_itemSlaves); Slave *s; while( (s = it.current()) != 0) @@ -262,9 +262,9 @@ void Item::delSlave(const QString &namearg) } } } -void Item::delSlaveByPath(const QString &patharg) +void Item::delSlaveByPath(const TQString &patharg) { - QPtrListIterator<Slave> it(*m_itemSlaves); + TQPtrListIterator<Slave> it(*m_itemSlaves); Slave *s; while( (s = it.current()) != 0) @@ -278,7 +278,7 @@ void Item::delSlaveByPath(const QString &patharg) } } -Alternative *Item::getAlternative(const QString &altpath) +Alternative *Item::getAlternative(const TQString &altpath) { Alternative *a; for(a = m_itemAlts->first(); a; a = m_itemAlts->next()) @@ -298,9 +298,9 @@ void Item::setAlternatives(AltsPtrList &alts) this->m_itemAlts = &alts; } -void Item::delAlternativeByPath(const QString &patharg) +void Item::delAlternativeByPath(const TQString &patharg) { - QPtrListIterator<Alternative> it(*m_itemAlts); + TQPtrListIterator<Alternative> it(*m_itemAlts); Alternative *a; while( (a = it.current()) != 0) @@ -316,7 +316,7 @@ void Item::delAlternativeByPath(const QString &patharg) void Item::delAlternativeByPriority(int priorityarg) { - QPtrListIterator<Alternative> it(*m_itemAlts); + TQPtrListIterator<Alternative> it(*m_itemAlts); Alternative *a; while( (a = it.current()) != 0) @@ -332,12 +332,12 @@ void Item::delAlternativeByPriority(int priorityarg) bool Item::isBroken() const { - return !QFile::exists(m_path); + return !TQFile::exists(m_path); } /********************** AltFIlesManager ************/ -AltFilesManager::AltFilesManager(const QString &altdirarg) : +AltFilesManager::AltFilesManager(const TQString &altdirarg) : m_altdir(altdirarg) { m_itemlist = new ItemPtrList; @@ -365,9 +365,9 @@ AltFilesManager::~AltFilesManager() */ } -Item* AltFilesManager::getItem(const QString &name) const +Item* AltFilesManager::getItem(const TQString &name) const { - QPtrListIterator<Item> it(*m_itemlist); + TQPtrListIterator<Item> it(*m_itemlist); Item *i; while( (i = it.current()) != 0) { @@ -381,17 +381,17 @@ Item* AltFilesManager::getItem(const QString &name) const return NULL; } -bool AltFilesManager::parseAltFiles(QString &errorstr) +bool AltFilesManager::parseAltFiles(TQString &errorstr) { - QDir d(m_altdir); - QStringList fileList = d.entryList(); - QStringList lines; - QFile altFile; - QString line, tmp; + TQDir d(m_altdir); + TQStringList fileList = d.entryList(); + TQStringList lines; + TQFile altFile; + TQString line, tmp; int nslaves; unsigned int index, slavesend; - for( QStringList::Iterator it = fileList.begin(); it != fileList.end(); ++it) + for( TQStringList::Iterator it = fileList.begin(); it != fileList.end(); ++it) { Item *item = new Item; if(*it == "." || *it == "..") { @@ -557,8 +557,8 @@ void AltFilesManager::debugPrintAlts() const printf("\t\t\tNo slaves\n"); else { - QStringList altslaves = *(a->getSlaves()); - QStringList::iterator sl; + TQStringList altslaves = *(a->getSlaves()); + TQStringList::iterator sl; for( sl = altslaves.begin(); sl != altslaves.end(); ++sl) { printf("\t\t\t%s\n", (*sl).ascii()); |
