summaryrefslogtreecommitdiffstats
path: root/kdesu
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:33:34 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:33:34 +0000
commitc663b6440964f6ac48027143ac9e63298991f9d0 (patch)
tree6d8b0c5a5f9db1ee16acf98b1397cea9126b281d /kdesu
parenta061f7191beebb0e4a3b0c0a7c534ec5f22f2dc7 (diff)
downloadtdebase-c663b6440964f6ac48027143ac9e63298991f9d0.tar.gz
tdebase-c663b6440964f6ac48027143ac9e63298991f9d0.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdesu')
-rw-r--r--kdesu/kdesu/kdesu.cpp60
-rw-r--r--kdesu/kdesu/sudlg.cpp8
-rw-r--r--kdesu/kdesu/sudlg.h4
-rw-r--r--kdesu/kdesud/handler.cpp26
-rw-r--r--kdesu/kdesud/handler.h10
-rw-r--r--kdesu/kdesud/kdesud.cpp16
-rw-r--r--kdesu/kdesud/lexer.cpp6
-rw-r--r--kdesu/kdesud/lexer.h8
-rw-r--r--kdesu/kdesud/repo.cpp30
-rw-r--r--kdesu/kdesud/repo.h28
10 files changed, 98 insertions, 98 deletions
diff --git a/kdesu/kdesu/kdesu.cpp b/kdesu/kdesu/kdesu.cpp
index 3e7b7a77b..af2986b06 100644
--- a/kdesu/kdesu/kdesu.cpp
+++ b/kdesu/kdesu/kdesu.cpp
@@ -19,11 +19,11 @@
#include <sys/wait.h>
#endif
-#include <qstring.h>
-#include <qfileinfo.h>
-#include <qglobal.h>
-#include <qfile.h>
-#include <qdir.h>
+#include <tqstring.h>
+#include <tqfileinfo.h>
+#include <tqglobal.h>
+#include <tqfile.h>
+#include <tqdir.h>
#include <dcopclient.h>
@@ -47,7 +47,7 @@
#define ERR strerror(errno)
-QCString command;
+TQCString command;
const char *Version = "1.0";
// NOTE: if you change the position of the -u switch, be sure to adjust it
@@ -70,11 +70,11 @@ static KCmdLineOptions options[] = {
};
-QCString dcopNetworkId()
+TQCString dcopNetworkId()
{
- QCString result;
+ TQCString result;
result.resize(1025);
- QFile file(DCOPClient::dcopServerFile());
+ TQFile file(DCOPClient::dcopServerFile());
if (!file.open(IO_ReadOnly))
return "";
int i = file.readLine(result.data(), 1024);
@@ -109,7 +109,7 @@ int main(int argc, char *argv[])
KCmdLineArgs::addCmdLineOptions(options);
KApplication::disableAutoDcopRegistration();
// kdesu doesn't process SM events, so don't even connect to ksmserver
- QCString session_manager = getenv( "SESSION_MANAGER" );
+ TQCString session_manager = getenv( "SESSION_MANAGER" );
unsetenv( "SESSION_MANAGER" );
KApplication app;
// but propagate it to the started app
@@ -155,7 +155,7 @@ static int startApp()
exit(1);
}
- QString icon;
+ TQString icon;
if ( args->isSet("i"))
icon = args->getOption("i");
@@ -164,8 +164,8 @@ static int startApp()
prompt = false;
// Get target uid
- QCString user = args->getOption("u");
- QCString auth_user = user;
+ TQCString user = args->getOption("u");
+ TQCString auth_user = user;
struct passwd *pw = getpwnam(user);
if (pw == 0L)
{
@@ -175,7 +175,7 @@ static int startApp()
bool change_uid = (getuid() != pw->pw_uid);
// If file is writeable, do not change uid
- QString file = QFile::decodeName(args->getOption("f"));
+ TQString file = TQFile::decodeName(args->getOption("f"));
if (change_uid && !file.isEmpty())
{
if (file.at(0) != '/')
@@ -189,7 +189,7 @@ static int startApp()
exit(1);
}
}
- QFileInfo fi(file);
+ TQFileInfo fi(file);
if (!fi.exists())
{
kdError(1206) << "File does not exist: " << file << "\n";
@@ -199,7 +199,7 @@ static int startApp()
}
// Get priority/scheduler
- QCString tmp = args->getOption("p");
+ TQCString tmp = args->getOption("p");
bool ok;
int priority = tmp.toInt(&ok);
if (!ok || (priority < 0) || (priority > 100))
@@ -222,10 +222,10 @@ static int startApp()
command = args->getOption("c");
for (int i=0; i<args->count(); i++)
{
- QString arg = QFile::decodeName(args->arg(i));
+ TQString arg = TQFile::decodeName(args->arg(i));
KRun::shellQuote(arg);
command += " ";
- command += QFile::encodeName(arg);
+ command += TQFile::encodeName(arg);
}
}
else
@@ -238,10 +238,10 @@ static int startApp()
command = args->arg(0);
for (int i=1; i<args->count(); i++)
{
- QString arg = QFile::decodeName(args->arg(i));
+ TQString arg = TQFile::decodeName(args->arg(i));
KRun::shellQuote(arg);
command += " ";
- command += QFile::encodeName(arg);
+ command += TQFile::encodeName(arg);
}
}
@@ -279,7 +279,7 @@ static int startApp()
bool withIgnoreButton = args->isSet("ignorebutton");
QCStringList env;
- QCString options;
+ TQCString options;
env << ( "DESKTOP_STARTUP_ID=" + kapp->startupId());
if (pw->pw_uid)
@@ -288,21 +288,21 @@ static int startApp()
// root uses KDEROOTHOME
// Translate the KDEHOME of this user to the new user.
- QString kdeHome = KGlobal::dirs()->relativeLocation("home", KGlobal::dirs()->localkdedir());
+ TQString kdeHome = KGlobal::dirs()->relativeLocation("home", KGlobal::dirs()->localkdedir());
if (kdeHome[0] != '/')
kdeHome.prepend("~/");
else
- kdeHome=QString::null; // Use default
+ kdeHome=TQString::null; // Use default
- env << ("KDEHOME="+ QFile::encodeName(kdeHome));
+ env << ("KDEHOME="+ TQFile::encodeName(kdeHome));
}
KUser u;
- env << (QCString) ("KDESU_USER=" + u.loginName().local8Bit());
+ env << (TQCString) ("KDESU_USER=" + u.loginName().local8Bit());
if (!new_dcop)
{
- QCString ksycoca = "KDESYCOCA="+QFile::encodeName(locateLocal("cache", "ksycoca"));
+ TQCString ksycoca = "KDESYCOCA="+TQFile::encodeName(locateLocal("cache", "ksycoca"));
env << ksycoca;
options += "xf"; // X-only, dcop forwarding enabled.
@@ -341,7 +341,7 @@ static int startApp()
int needpw = proc.checkNeedPassword();
if (needpw < 0)
{
- QString err = i18n("Su returned with an error.\n");
+ TQString err = i18n("Su returned with an error.\n");
KMessageBox::error(0L, err);
exit(1);
}
@@ -352,7 +352,7 @@ static int startApp()
}
// Start the dialog
- QCString password;
+ TQCString password;
if (needpw)
{
KStartupInfoId id;
@@ -365,10 +365,10 @@ static int startApp()
dlg.addLine(i18n("Command:"), command);
if ((priority != 50) || (scheduler != SuProcess::SchedNormal))
{
- QString prio;
+ TQString prio;
if (scheduler == SuProcess::SchedRealtime)
prio += i18n("realtime: ");
- prio += QString("%1/100").arg(priority);
+ prio += TQString("%1/100").arg(priority);
if (prompt)
dlg.addLine(i18n("Priority:"), prio);
}
diff --git a/kdesu/kdesu/sudlg.cpp b/kdesu/kdesu/sudlg.cpp
index d68937372..f2ec71723 100644
--- a/kdesu/kdesu/sudlg.cpp
+++ b/kdesu/kdesu/sudlg.cpp
@@ -5,7 +5,7 @@
*/
#include <config.h>
-#include <qstring.h>
+#include <tqstring.h>
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
@@ -14,12 +14,12 @@
#include <kdesu/su.h>
#include "sudlg.h"
-KDEsuDialog::KDEsuDialog(QCString user, QCString auth_user, bool enableKeep,const QString& icon, bool withIgnoreButton)
+KDEsuDialog::KDEsuDialog(TQCString user, TQCString auth_user, bool enableKeep,const TQString& icon, bool withIgnoreButton)
: KPasswordDialog(Password, enableKeep, (withIgnoreButton ? User1:NoDefault), icon)
{
KConfig* config = KGlobal::config();
config->setGroup("super-user-command");
- QString superUserCommand = config->readEntry("super-user-command", DEFAULT_SUPER_USER_COMMAND);
+ TQString superUserCommand = config->readEntry("super-user-command", DEFAULT_SUPER_USER_COMMAND);
if ( superUserCommand != "sudo" && superUserCommand != "su" ) {
kdWarning() << "unknown super user command" << endl;
superUserCommand = "su";
@@ -28,7 +28,7 @@ KDEsuDialog::KDEsuDialog(QCString user, QCString auth_user, bool enableKeep,cons
m_User = auth_user;
setCaption(i18n("Run as %1").arg(user));
- QString prompt;
+ TQString prompt;
if (superUserCommand == "sudo" && m_User == "root") {
prompt = i18n("Please enter your password." );
} else {
diff --git a/kdesu/kdesu/sudlg.h b/kdesu/kdesu/sudlg.h
index 5f5340fc2..4277ca67c 100644
--- a/kdesu/kdesu/sudlg.h
+++ b/kdesu/kdesu/sudlg.h
@@ -15,7 +15,7 @@ class KDEsuDialog
Q_OBJECT
public:
- KDEsuDialog(QCString user, QCString auth_user, bool enableKeep, const QString& icon , bool withIgnoreButton=false);
+ KDEsuDialog(TQCString user, TQCString auth_user, bool enableKeep, const TQString& icon , bool withIgnoreButton=false);
~KDEsuDialog();
enum ResultCodes { AsUser = 10 };
@@ -25,7 +25,7 @@ protected:
void slotUser1();
private:
- QCString m_User;
+ TQCString m_User;
};
diff --git a/kdesu/kdesud/handler.cpp b/kdesu/kdesud/handler.cpp
index f18a874da..1d52a58ac 100644
--- a/kdesu/kdesud/handler.cpp
+++ b/kdesu/kdesud/handler.cpp
@@ -18,7 +18,7 @@
#include <sys/socket.h>
#include <sys/types.h>
-#include <qcstring.h>
+#include <tqcstring.h>
#include <kdebug.h>
#include <kdesu/su.h>
@@ -86,7 +86,7 @@ int ConnectionHandler::handle()
// Do we have a complete command yet?
int n;
- QCString newbuf;
+ TQCString newbuf;
while ((n = m_Buf.find('\n')) != -1)
{
newbuf = m_Buf.left(n+1);
@@ -100,10 +100,10 @@ int ConnectionHandler::handle()
return 0;
}
-QCString ConnectionHandler::makeKey(int _namespace, QCString s1,
- QCString s2, QCString s3)
+TQCString ConnectionHandler::makeKey(int _namespace, TQCString s1,
+ TQCString s2, TQCString s3)
{
- QCString res;
+ TQCString res;
res.setNum(_namespace);
res += "*";
res += s1 + "*" + s2 + "*" + s3;
@@ -114,7 +114,7 @@ void ConnectionHandler::sendExitCode()
{
if (!m_needExitCode)
return;
- QCString buf;
+ TQCString buf;
buf.setNum(m_exitCode);
buf.prepend("OK ");
buf.append("\n");
@@ -122,9 +122,9 @@ void ConnectionHandler::sendExitCode()
send(m_Fd, buf.data(), buf.length(), 0);
}
-void ConnectionHandler::respond(int ok, QCString s)
+void ConnectionHandler::respond(int ok, TQCString s)
{
- QCString buf;
+ TQCString buf;
switch (ok) {
case Res_OK:
@@ -152,7 +152,7 @@ void ConnectionHandler::respond(int ok, QCString s)
* close the socket in the main accept loop.
*/
-int ConnectionHandler::doCommand(QCString buf)
+int ConnectionHandler::doCommand(TQCString buf)
{
if ((uid_t) peerUid() != getuid())
{
@@ -161,7 +161,7 @@ int ConnectionHandler::doCommand(QCString buf)
return -1;
}
- QCString key, command, pass, name, user, value, env_check;
+ TQCString key, command, pass, name, user, value, env_check;
Data_entry data;
Lexer *l = new Lexer(buf);
@@ -221,7 +221,7 @@ int ConnectionHandler::doCommand(QCString buf)
case Lexer::Tok_exec: // "EXEC command:string user:string [options:string (env:string)*]\n"
{
- QCString options;
+ TQCString options;
QCStringList env;
tok = l->lex();
if (tok != Lexer::Tok_str)
@@ -242,7 +242,7 @@ int ConnectionHandler::doCommand(QCString buf)
{
if (tok != Lexer::Tok_str)
goto parse_error;
- QCString env_str = l->lval();
+ TQCString env_str = l->lval();
env.append(env_str);
if (strncmp(env_str, "DESKTOP_STARTUP_ID=", strlen("DESKTOP_STARTUP_ID=")) != 0)
env_check += "*"+env_str;
@@ -250,7 +250,7 @@ int ConnectionHandler::doCommand(QCString buf)
}
}
- QCString auth_user;
+ TQCString auth_user;
if ((m_Scheduler != SuProcess::SchedNormal) || (m_Priority > 50))
auth_user = "root";
else
diff --git a/kdesu/kdesud/handler.h b/kdesu/kdesud/handler.h
index acfada51b..785d1179f 100644
--- a/kdesu/kdesud/handler.h
+++ b/kdesu/kdesud/handler.h
@@ -9,7 +9,7 @@
#include <sys/types.h>
-#include <qcstring.h>
+#include <tqcstring.h>
#include "secure.h"
/**
@@ -35,13 +35,13 @@ public:
private:
enum Results { Res_OK, Res_NO };
- int doCommand(QCString buf);
- void respond(int ok, QCString s=0);
- QCString makeKey(int namspace, QCString s1, QCString s2=0, QCString s3=0);
+ int doCommand(TQCString buf);
+ void respond(int ok, TQCString s=0);
+ TQCString makeKey(int namspace, TQCString s1, TQCString s2=0, TQCString s3=0);
int m_Fd, m_Timeout;
int m_Priority, m_Scheduler;
- QCString m_Buf, m_Pass, m_Host;
+ TQCString m_Buf, m_Pass, m_Host;
public:
int m_exitCode;
bool m_hasExitCode;
diff --git a/kdesu/kdesud/kdesud.cpp b/kdesu/kdesud/kdesud.cpp
index d81b6a0c9..3e9462698 100644
--- a/kdesu/kdesud/kdesud.cpp
+++ b/kdesu/kdesud/kdesud.cpp
@@ -56,9 +56,9 @@
#include <sys/select.h> // Needed on some systems.
#endif
-#include <qptrvector.h>
-#include <qfile.h>
-#include <qregexp.h>
+#include <tqptrvector.h>
+#include <tqfile.h>
+#include <tqregexp.h>
#include <kinstance.h>
#include <kdebug.h>
@@ -87,7 +87,7 @@
Repository *repo;
const char *Version = "1.01";
-QCString sock;
+TQCString sock;
Display *x11Display;
int pipeOfDeath[2];
@@ -157,7 +157,7 @@ int create_socket()
ksocklen_t addrlen;
struct stat s;
- QCString display(getenv("DISPLAY"));
+ TQCString display(getenv("DISPLAY"));
if (display.isEmpty())
{
kdWarning(1205) << "$DISPLAY is not set\n";
@@ -165,9 +165,9 @@ int create_socket()
}
// strip the screen number from the display
- display.replace(QRegExp("\\.[0-9]+$"), "");
+ display.replace(TQRegExp("\\.[0-9]+$"), "");
- sock = QFile::encodeName(locateLocal("socket", QString("kdesud_%1").arg(display)));
+ sock = TQFile::encodeName(locateLocal("socket", TQString("kdesud_%1").arg(display)));
int stat_err=lstat(sock, &s);
if(!stat_err && S_ISLNK(s.st_mode)) {
kdWarning(1205) << "Someone is running a symlink attack on you\n";
@@ -294,7 +294,7 @@ int main(int argc, char *argv[])
maxfd = QMAX(maxfd, x11Fd);
repo = new Repository;
- QPtrVector<ConnectionHandler> handler;
+ TQPtrVector<ConnectionHandler> handler;
handler.setAutoDelete(true);
pipe(pipeOfDeath);
diff --git a/kdesu/kdesud/lexer.cpp b/kdesu/kdesud/lexer.cpp
index a05251a58..d9fbf4639 100644
--- a/kdesu/kdesud/lexer.cpp
+++ b/kdesu/kdesud/lexer.cpp
@@ -8,11 +8,11 @@
*/
#include <ctype.h>
-#include <qcstring.h>
+#include <tqcstring.h>
#include "lexer.h"
-Lexer::Lexer(const QCString &input)
+Lexer::Lexer(const TQCString &input)
{
m_Input = input;
in = 0;
@@ -25,7 +25,7 @@ Lexer::~Lexer()
m_Output.fill('x');
}
-QCString &Lexer::lval()
+TQCString &Lexer::lval()
{
return m_Output;
}
diff --git a/kdesu/kdesud/lexer.h b/kdesu/kdesud/lexer.h
index e678d746e..835cc375b 100644
--- a/kdesu/kdesud/lexer.h
+++ b/kdesu/kdesud/lexer.h
@@ -15,14 +15,14 @@ class QCString;
class Lexer {
public:
- Lexer(const QCString &input);
+ Lexer(const TQCString &input);
~Lexer();
/** Read next token. */
int lex();
/** Return the token's value. */
- QCString &lval();
+ TQCString &lval();
enum Tokens {
Tok_none, Tok_exec=256, Tok_pass, Tok_delCmd,
@@ -33,8 +33,8 @@ public:
};
private:
- QCString m_Input;
- QCString m_Output;
+ TQCString m_Input;
+ TQCString m_Output;
int in;
};
diff --git a/kdesu/kdesud/repo.cpp b/kdesu/kdesud/repo.cpp
index 783a9baca..cdbbcaed1 100644
--- a/kdesu/kdesud/repo.cpp
+++ b/kdesu/kdesud/repo.cpp
@@ -7,9 +7,9 @@
#include <time.h>
#include <assert.h>
-#include <qcstring.h>
-#include <qmap.h>
-#include <qvaluestack.h>
+#include <tqcstring.h>
+#include <tqmap.h>
+#include <tqvaluestack.h>
#include <kdebug.h>
#include "repo.h"
@@ -25,7 +25,7 @@ Repository::~Repository()
{}
-void Repository::add(const QCString &key, Data_entry &data)
+void Repository::add(const TQCString &key, Data_entry &data)
{
RepoIterator it = repo.find(key);
if (it != repo.end())
@@ -38,7 +38,7 @@ void Repository::add(const QCString &key, Data_entry &data)
repo.insert(key, data);
}
-int Repository::remove(const QCString &key)
+int Repository::remove(const TQCString &key)
{
if( key.isEmpty() )
return -1;
@@ -52,12 +52,12 @@ int Repository::remove(const QCString &key)
return 0;
}
-int Repository::removeSpecialKey(const QCString &key)
+int Repository::removeSpecialKey(const TQCString &key)
{
int found = -1;
if ( !key.isEmpty() )
{
- QValueStack<QCString> rm_keys;
+ TQValueStack<TQCString> rm_keys;
for (RepoCIterator it=repo.begin(); it!=repo.end(); ++it)
{
if ( key.find( it.data().group ) == 0 &&
@@ -76,12 +76,12 @@ int Repository::removeSpecialKey(const QCString &key)
return found;
}
-int Repository::removeGroup(const QCString &group)
+int Repository::removeGroup(const TQCString &group)
{
int found = -1;
if ( !group.isEmpty() )
{
- QValueStack<QCString> rm_keys;
+ TQValueStack<TQCString> rm_keys;
for (RepoCIterator it=repo.begin(); it!=repo.end(); ++it)
{
if (it.data().group == group)
@@ -99,7 +99,7 @@ int Repository::removeGroup(const QCString &group)
return found;
}
-int Repository::hasGroup(const QCString &group) const
+int Repository::hasGroup(const TQCString &group) const
{
if ( !group.isEmpty() )
{
@@ -113,14 +113,14 @@ int Repository::hasGroup(const QCString &group) const
return -1;
}
-QCString Repository::findKeys(const QCString &group, const char *sep ) const
+TQCString Repository::findKeys(const TQCString &group, const char *sep ) const
{
- QCString list="";
+ TQCString list="";
if( !group.isEmpty() )
{
kdDebug(1205) << "Looking for matching key with group key: " << group << endl;
int pos;
- QCString key;
+ TQCString key;
RepoCIterator it;
for (it=repo.begin(); it!=repo.end(); ++it)
{
@@ -149,7 +149,7 @@ QCString Repository::findKeys(const QCString &group, const char *sep ) const
return list;
}
-QCString Repository::find(const QCString &key) const
+TQCString Repository::find(const TQCString &key) const
{
if( key.isEmpty() )
return 0;
@@ -168,7 +168,7 @@ int Repository::expire()
return 0;
unsigned t;
- QValueStack<QCString> keys;
+ TQValueStack<TQCString> keys;
head_time = (unsigned) -1;
RepoIterator it;
for (it=repo.begin(); it!=repo.end(); ++it)
diff --git a/kdesu/kdesud/repo.h b/kdesu/kdesud/repo.h
index fde8cd250..24c156a34 100644
--- a/kdesu/kdesud/repo.h
+++ b/kdesu/kdesud/repo.h
@@ -8,8 +8,8 @@
#define __Repo_h_included__
-#include <qmap.h>
-#include <qcstring.h>
+#include <tqmap.h>
+#include <tqcstring.h>
/**
@@ -17,8 +17,8 @@
*/
struct Data_entry
{
- QCString value;
- QCString group;
+ TQCString value;
+ TQCString group;
unsigned int timeout;
};
@@ -37,31 +37,31 @@ public:
int expire();
/** Add a data element */
- void add(const QCString& key, Data_entry& data);
+ void add(const TQCString& key, Data_entry& data);
/** Delete a data element. */
- int remove(const QCString& key);
+ int remove(const TQCString& key);
/** Delete all data entries having the given group. */
- int removeGroup(const QCString& group);
+ int removeGroup(const TQCString& group);
/** Delete all data entries based on key. */
- int removeSpecialKey(const QCString& key );
+ int removeSpecialKey(const TQCString& key );
/** Checks for the existence of the specified group. */
- int hasGroup(const QCString &group) const;
+ int hasGroup(const TQCString &group) const;
/** Return a data value. */
- QCString find(const QCString& key) const;
+ TQCString find(const TQCString& key) const;
/** Returns the key values for the given group. */
- QCString findKeys(const QCString& group, const char *sep= "-") const;
+ TQCString findKeys(const TQCString& group, const char *sep= "-") const;
private:
- QMap<QCString,Data_entry> repo;
- typedef QMap<QCString,Data_entry>::Iterator RepoIterator;
- typedef QMap<QCString,Data_entry>::ConstIterator RepoCIterator;
+ TQMap<TQCString,Data_entry> repo;
+ typedef TQMap<TQCString,Data_entry>::Iterator RepoIterator;
+ typedef TQMap<TQCString,Data_entry>::ConstIterator RepoCIterator;
unsigned head_time;
};