summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kdesudo/kdesudo.cpp110
-rw-r--r--kdesudo/kdesudo.h20
-rw-r--r--kdesudo/main.cpp30
3 files changed, 80 insertions, 80 deletions
diff --git a/kdesudo/kdesudo.cpp b/kdesudo/kdesudo.cpp
index e746703..7d48de5 100644
--- a/kdesudo/kdesudo.cpp
+++ b/kdesudo/kdesudo.cpp
@@ -20,10 +20,10 @@
#include "kdesudo.h"
-#include <qfile.h>
-#include <qdir.h>
-#include <qdatastream.h>
-#include <qstring.h>
+#include <tqfile.h>
+#include <tqdir.h>
+#include <tqdatastream.h>
+#include <tqstring.h>
#include <kcmdlineargs.h>
#include <klocale.h>
@@ -43,12 +43,12 @@
#include <sys/stat.h>
#include <sys/types.h>
-KdeSudo::KdeSudo(QWidget *parent, const char *name,const QString& icon, const QString& generic, bool withIgnoreButton)
- : KPasswordDialog(KPasswordDialog::Password, false, (withIgnoreButton ? User1: false), icon, parent, name)
+KdeSudo::KdeSudo(TQWidget *tqparent, const char *name,const TQString& icon, const TQString& generic, bool withIgnoreButton)
+ : KPasswordDialog(KPasswordDialog::Password, false, (withIgnoreButton ? User1: false), icon, tqparent, name)
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
- QString defaultComment = i18n("<b>%1</b> needs administrative privileges. Please enter your password for verification.");
+ TQString defaultComment = i18n("<b>%1</b> needs administrative privileges. Please enter your password for verification.");
p=NULL;
bError=false;
@@ -63,8 +63,8 @@ KdeSudo::KdeSudo(QWidget *parent, const char *name,const QString& icon, const QS
bool noExec = false;
keepPwd = (!args->isSet("n"));
emptyPwd = args->isSet("s");
- QString runas = args->getOption("u");
- QString cmd;
+ TQString runas = args->getOption("u");
+ TQString cmd;
if (!args->isSet("c") && !args->count() && (!args->isSet("s")))
{
@@ -78,15 +78,15 @@ KdeSudo::KdeSudo(QWidget *parent, const char *name,const QString& icon, const QS
// Parsins args
/* Get the comment out of cli args */
- QByteArray commentBytes = args->getOption("comment");
- QTextCodec* tCodecConv = QTextCodec::codecForLocale();
- QString comment = tCodecConv->toUnicode(commentBytes, commentBytes.size());
+ TQByteArray commentBytes = args->getOption("comment");
+ TQTextCodec* tCodecConv = TQTextCodec::codecForLocale();
+ TQString comment = tCodecConv->toUnicode(commentBytes, commentBytes.size());
if (args->isSet("f"))
{
// If file is writeable, do not change uid
- QString filename = QFile::decodeName(args->getOption("f"));
- QString file = filename;
+ TQString filename = TQFile::decodeName(args->getOption("f"));
+ TQString file = filename;
if (!file.isEmpty())
{
if (file.at(0) != '/')
@@ -100,7 +100,7 @@ KdeSudo::KdeSudo(QWidget *parent, const char *name,const QString& icon, const QS
exit(1);
}
}
- QFileInfo fi(file);
+ TQFileInfo fi(file);
if (!fi.exists())
{
kdError(1206) << "File does not exist: " << file << "\n";
@@ -124,8 +124,8 @@ KdeSudo::KdeSudo(QWidget *parent, const char *name,const QString& icon, const QS
// from the existing server and set ICEAUTHORITY to point to the file
if (!newDcop) {
dcopServer = m_pCookie->dcopServer();
- QCString dcopAuth = m_pCookie->dcopAuth();
- QCString iceAuth = m_pCookie->iceAuth();
+ TQCString dcopAuth = m_pCookie->dcopAuth();
+ TQCString iceAuth = m_pCookie->iceAuth();
FILE *fout;
char iceauthority[200];
@@ -161,14 +161,14 @@ KdeSudo::KdeSudo(QWidget *parent, const char *name,const QString& icon, const QS
pclose(fout);
// Exporting the user's sycoca
- kdeSycoca = QFile::encodeName(locateLocal("cache", "ksycoca"));
+ kdeSycoca = TQFile::encodeName(locateLocal("cache", "ksycoca"));
}
- connect( p, SIGNAL(receivedStdout(KProcess*, char*, int)), this, SLOT(receivedOut(KProcess*, char*, int)) );
- connect( p, SIGNAL(receivedStderr(KProcess*, char*, int)), this, SLOT(receivedOut(KProcess*, char*, int)) );
- connect( p, SIGNAL(processExited (KProcess *)), this, SLOT(procExited(KProcess*)));
+ connect( p, TQT_SIGNAL(receivedStdout(KProcess*, char*, int)), this, TQT_SLOT(receivedOut(KProcess*, char*, int)) );
+ connect( p, TQT_SIGNAL(receivedStderr(KProcess*, char*, int)), this, TQT_SLOT(receivedOut(KProcess*, char*, int)) );
+ connect( p, TQT_SIGNAL(processExited (KProcess *)), this, TQT_SLOT(procExited(KProcess*)));
- QString xauthenv = QString(getenv("HOME")) + "/.Xauthority";
+ TQString xauthenv = TQString(getenv("HOME")) + "/.Xauthority";
p->setEnvironment("XAUTHORITY", xauthenv);
// Generate the xauth cookie and put it in a tempfile
@@ -182,10 +182,10 @@ KdeSudo::KdeSudo(QWidget *parent, const char *name,const QString& icon, const QS
FILE *f;
char buf[1024];
- QCString disp = m_pCookie->display();
+ TQCString disp = m_pCookie->display();
// command: xauth -q -f m_tmpname generate $DISPLAy . trusted timeout 60
- QString c = "/usr/bin/xauth -q -f " + m_tmpname + " generate "
- + QString::fromLocal8Bit(disp) + " . trusted timeout 60";
+ TQString c = "/usr/bin/xauth -q -f " + m_tmpname + " generate "
+ + TQString::fromLocal8Bit(disp) + " . trusted timeout 60";
blockSigChild(); // pclose uses waitpid()
if (!(f = popen(c, "r"))) {
@@ -196,7 +196,7 @@ KdeSudo::KdeSudo(QWidget *parent, const char *name,const QString& icon, const QS
// non root users need to be able to read the xauth file.
// the xauth file is deleted when kdesudo exits. security?
- QFile tf(m_tmpname);
+ TQFile tf(m_tmpname);
if (!runas.isEmpty() && runas != "root" && tf.exists())
chmod(m_tmpname.ascii(),0644);
@@ -237,36 +237,36 @@ KdeSudo::KdeSudo(QWidget *parent, const char *name,const QString& icon, const QS
if (realtime)
{
*p << "nice" << "-n" << "10";
- addLine(i18n("Priority:"), i18n("realtime:") + QChar(' ') + QString("50/100"));
+ addLine(i18n("Priority:"), i18n("realtime:") + TQChar(' ') + TQString("50/100"));
}
else if (priority)
{
- QString n = args->getOption("p");
+ TQString n = args->getOption("p");
int intn = atoi(n);
intn = (intn * 40 / 100) - (20 + 0.5);
- QString strn;
+ TQString strn;
strn.sprintf("%d",intn);
*p << "nice" << "-n" << strn;
- addLine(i18n("Priority:"), n + QString("/100"));
+ addLine(i18n("Priority:"), n + TQString("/100"));
}
*p << "--";
if (args->isSet("c"))
{
- QString command = args->getOption("c");
- QStringList commandSplit = KShell::splitArgs(command);
+ TQString command = args->getOption("c");
+ TQStringList commandSplit = KShell::splitArgs(command);
for (int i = 0; i < commandSplit.count(); i++)
{
- QString arg = validArg(commandSplit[i]);
+ TQString arg = validArg(commandSplit[i]);
*p << arg;
if (i == 0)
- cmd += validArg(commandSplit[i]) + QChar(' ');
+ cmd += validArg(commandSplit[i]) + TQChar(' ');
else
- cmd += KProcess::quote(validArg(commandSplit[i])) + QChar(' ');
+ cmd += KProcess::quote(validArg(commandSplit[i])) + TQChar(' ');
}
}
@@ -276,20 +276,20 @@ KdeSudo::KdeSudo(QWidget *parent, const char *name,const QString& icon, const QS
{
if ((!args->isSet("c")) && (i == 0))
{
- QStringList argsSplit = KShell::splitArgs(args->arg(i));
+ TQStringList argsSplit = KShell::splitArgs(args->arg(i));
for (int j = 0; j < argsSplit.count(); j++)
{
*p << validArg(argsSplit[j]);
if (j == 0)
- cmd += validArg(argsSplit[j]) + QChar(' ');
+ cmd += validArg(argsSplit[j]) + TQChar(' ');
else
- cmd += KProcess::quote(validArg(argsSplit[j])) + QChar(' ');
+ cmd += KProcess::quote(validArg(argsSplit[j])) + TQChar(' ');
}
}
else
{
*p << validArg(args->arg(i));
- cmd += validArg(args->arg(i)) + QChar(' ');
+ cmd += validArg(args->arg(i)) + TQChar(' ');
}
}
}
@@ -301,9 +301,9 @@ KdeSudo::KdeSudo(QWidget *parent, const char *name,const QString& icon, const QS
if (comment.isEmpty())
{
if (!generic.isEmpty())
- setPrompt(defaultComment.arg(generic));
+ setPrompt(defaultComment.tqarg(generic));
else
- setPrompt(defaultComment.arg(cmd));
+ setPrompt(defaultComment.tqarg(cmd));
}
else
setPrompt(comment);
@@ -323,13 +323,13 @@ void KdeSudo::receivedOut(KProcess*, char*buffer, int buflen)
char *pcTmp= new char[buflen+1];
strncpy(pcTmp,buffer,buflen);
pcTmp[buflen]='\0';
- QString strOut(pcTmp);
+ TQString strOut(pcTmp);
std::cout << strOut << std::endl;
static int badpass = 0;
- if (strOut.find("Sorry, try again")!=-1)
+ if (strOut.tqfind("Sorry, try again")!=-1)
{
badpass++;
if (badpass>2)
@@ -339,37 +339,37 @@ void KdeSudo::receivedOut(KProcess*, char*buffer, int buflen)
kapp->quit();
}
}
- if (strOut.find("command not found")!=-1)
+ if (strOut.tqfind("command not found")!=-1)
{
bError=true;
KMessageBox::error(this, i18n("Command not found!"));
kapp->quit();
}
- if (strOut.find("is not in the sudoers file")!=-1)
+ if (strOut.tqfind("is not in the sudoers file")!=-1)
{
bError=true;
KMessageBox::error(this, i18n("Your username is unknown to sudo!"));
kapp->quit();
}
- if (strOut.find("is not allowed to execute")!=-1)
+ if (strOut.tqfind("is not allowed to execute")!=-1)
{
bError=true;
KMessageBox::error(this, i18n("Your user is not allowed to run the specified command!"));
kapp->quit();
}
- if (strOut.find("is not allowed to run sudo on")!=-1)
+ if (strOut.tqfind("is not allowed to run sudo on")!=-1)
{
bError=true;
KMessageBox::error(this, i18n("Your user is not allowed to run sudo on this host!"));
kapp->quit();
}
- if (strOut.find("may not run sudo on")!=-1)
+ if (strOut.tqfind("may not run sudo on")!=-1)
{
bError=true;
KMessageBox::error(this, i18n("Your user is not allowed to run sudo on this host!"));
kapp->quit();
}
- if ((strOut.find("passprompt")!=-1) || (strOut.find("PIN (CHV2)")!=-1))
+ if ((strOut.tqfind("passprompt")!=-1) || (strOut.tqfind("PIN (CHV2)")!=-1))
{
this->clearPassword();
this->show();
@@ -388,18 +388,18 @@ void KdeSudo::procExited(KProcess*)
if (!newDcop && !iceauthorityFile.isEmpty())
if (!iceauthorityFile.isEmpty())
- QFile::remove(iceauthorityFile);
+ TQFile::remove(iceauthorityFile);
if (!bError) {
if (!m_tmpname.isEmpty())
- QFile::remove(m_tmpname);
+ TQFile::remove(m_tmpname);
kapp->quit();
}
}
void KdeSudo::slotOk()
{
- QString strTmp(password());
+ TQString strTmp(password());
strTmp+="\n";
p->writeStdin(strTmp.ascii(),(int)strTmp.length());
this->hide();
@@ -425,10 +425,10 @@ void KdeSudo::unblockSigChild()
sigprocmask(SIG_UNBLOCK, &sset, 0L);
}
-QString KdeSudo::validArg(QString arg)
+TQString KdeSudo::validArg(TQString arg)
{
- QChar firstChar = arg.at(0);
- QChar lastChar = arg.at(arg.length() - 1);
+ TQChar firstChar = arg.at(0);
+ TQChar lastChar = arg.at(arg.length() - 1);
if ( (firstChar == '"' && lastChar == '"') || (firstChar == '\'' && lastChar == '\'') )
{
diff --git a/kdesudo/kdesudo.h b/kdesudo/kdesudo.h
index 0c59047..2fa278f 100644
--- a/kdesudo/kdesudo.h
+++ b/kdesudo/kdesudo.h
@@ -26,10 +26,10 @@
#endif
#include <kapp.h>
-#include <qwidget.h>
+#include <tqwidget.h>
#include <kpassdlg.h>
-#include <qstring.h>
-#include <qtextcodec.h>
+#include <tqstring.h>
+#include <tqtextcodec.h>
#include <kprocess.h>
class KCookie;
@@ -45,12 +45,12 @@ class KCookie;
class KdeSudo : public KPasswordDialog
{
- Q_OBJECT
+ TQ_OBJECT
public:
/*
* Default construtor
*/
- KdeSudo(QWidget* parent=0, const char *name=0, const QString& icon=QString(), const QString& generic=QString(), bool withIgnoreButton=false);
+ KdeSudo(TQWidget* tqparent=0, const char *name=0, const TQString& icon=TQString(), const TQString& generic=TQString(), bool withIgnoreButton=false);
/*
* Default destructor
@@ -73,7 +73,7 @@ public slots: // Public slots
*/
void slotOk();
void slotUser1();
- QString validArg(QString arg);
+ TQString validArg(TQString arg);
private: // Private attributes
KProcess * p;
@@ -84,10 +84,10 @@ private: // Private attributes
bool useTerm;
bool noExec;
bool unCleaned;
- QString m_tmpname;
- QString iceauthorityFile;
- QString dcopServer;
- QString kdeSycoca;
+ TQString m_tmpname;
+ TQString iceauthorityFile;
+ TQString dcopServer;
+ TQString kdeSycoca;
KCookie* m_pCookie;
void blockSigChild();
void unblockSigChild();
diff --git a/kdesudo/main.cpp b/kdesudo/main.cpp
index 7306629..6ef0074 100644
--- a/kdesudo/main.cpp
+++ b/kdesudo/main.cpp
@@ -31,8 +31,8 @@
#include <kstandarddirs.h>
#include <kprocess.h>
#include <kdebug.h>
-#include <qfile.h>
-#include <qfileinfo.h>
+#include <tqfile.h>
+#include <tqfileinfo.h>
static const char *description =
I18N_NOOP("KdeSudo");
@@ -72,12 +72,12 @@ int main(int argc, char **argv)
KApplication a;
- QString executable;
- QStringList executableList;
- QString arg;
- QString command;
- QStringList commandlist;
- QString icon;
+ TQString executable;
+ TQStringList executableList;
+ TQString arg;
+ TQString command;
+ TQStringList commandlist;
+ TQString icon;
bool withIgnoreButton = args->isSet("ignorebutton");
@@ -89,16 +89,16 @@ int main(int argc, char **argv)
if (executable.isEmpty())
{
command = args->arg(0);
- commandlist = QStringList::split(QChar(' '), command);
+ commandlist = TQStringList::split(TQChar(' '), command);
executable = commandlist[0];
}
}
/* We have to make sure the executable is only the binary name */
- executableList = QStringList::split(" ", executable);
+ executableList = TQStringList::split(" ", executable);
executable = executableList[0];
- executableList = QStringList::split("/", executable);
+ executableList = TQStringList::split("/", executable);
int i = executableList.count() - 1;
executable = executableList[i];
@@ -106,7 +106,7 @@ int main(int argc, char **argv)
KGlobal::dirs()->addResourceDir("apps","/usr/share/applications/kde");
KGlobal::dirs()->addResourceDir("apps","/usr/share/applications");
- QString deskFilePath = KGlobal::dirs()->findResource("apps",executable + ".desktop");
+ TQString deskFilePath = KGlobal::dirs()->findResource("apps",executable + ".desktop");
KDesktopFile desktopFile(deskFilePath,true);
/* icon parsing */
@@ -114,13 +114,13 @@ int main(int argc, char **argv)
icon = args->getOption("i");
else
{
- QString iconName = desktopFile.readIcon();
+ TQString iconName = desktopFile.readIcon();
icon = KGlobal::iconLoader()->iconPath(iconName, -1* KIcon::StdSizes(KIcon::SizeHuge), true);
}
/* generic name parsing */
- QString name = desktopFile.readName();
- QString genericName = desktopFile.readGenericName();
+ TQString name = desktopFile.readName();
+ TQString genericName = desktopFile.readGenericName();
if (!name.isEmpty())
{