mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kdesudo: move variables close to the used scope
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
0156f73bef
commit
7cd40f83cc
1 changed files with 10 additions and 16 deletions
|
@ -77,19 +77,16 @@ int main(int argc, char **argv)
|
||||||
KCmdLineOptions options;
|
KCmdLineOptions options;
|
||||||
options.add("u <runas>", ki18n("sets a runas user"));
|
options.add("u <runas>", ki18n("sets a runas user"));
|
||||||
options.add("c <command>", ki18n("The command to execute"));
|
options.add("c <command>", ki18n("The command to execute"));
|
||||||
options.add("i <icon name>", ki18n("Specify icon to use in the password"
|
options.add("i <icon name>", ki18n("Specify icon to use in the password dialog"));
|
||||||
" dialog"));
|
|
||||||
options.add("d", ki18n("Do not show the command to be run in the dialog"));
|
options.add("d", ki18n("Do not show the command to be run in the dialog"));
|
||||||
options.add("p <priority>", ki18n("Process priority, between 0 and 100,"
|
options.add("p <priority>", ki18n("Process priority, between 0 and 100, 0 the lowest [50]"));
|
||||||
" 0 the lowest [50]"));
|
|
||||||
options.add("r", ki18n("Use realtime scheduling"));
|
options.add("r", ki18n("Use realtime scheduling"));
|
||||||
options.add("f <file>", ki18n("Use target UID if <file> is not writeable"));
|
options.add("f <file>", ki18n("Use target UID if <file> is not writeable"));
|
||||||
options.add("nodbus", ki18n("Do not start a message bus"));
|
options.add("nodbus", ki18n("Do not start a message bus"));
|
||||||
options.add("comment <dialog text>", ki18n("The comment that should be "
|
options.add("comment <dialog text>", ki18n("The comment that should be "
|
||||||
"displayed in the dialog"));
|
"displayed in the dialog"));
|
||||||
options.add("attach <winid>", ki18n("Makes the dialog transient for an X app specified by winid"));
|
options.add("attach <winid>", ki18n("Makes the dialog transient for an X app specified by winid"));
|
||||||
options.add("desktop <desktop file>", ki18n("Manual override for "
|
options.add("desktop <desktop file>", ki18n("Manual override for automatic desktop file detection"));
|
||||||
"automatic desktop file detection"));
|
|
||||||
|
|
||||||
options.add("+command", ki18n("The command to execute"));
|
options.add("+command", ki18n("The command to execute"));
|
||||||
|
|
||||||
|
@ -99,9 +96,9 @@ int main(int argc, char **argv)
|
||||||
KApplication a;
|
KApplication a;
|
||||||
a.disableSessionManagement();
|
a.disableSessionManagement();
|
||||||
|
|
||||||
QString executable, icon;
|
QString executable;
|
||||||
QStringList executableList, commandlist;
|
QStringList executableList;
|
||||||
KDesktopFile *desktopFile;
|
KDesktopFile *desktopFile = nullptr;
|
||||||
|
|
||||||
if (args->isSet("c")) {
|
if (args->isSet("c")) {
|
||||||
executable = args->getOption("c");
|
executable = args->getOption("c");
|
||||||
|
@ -109,7 +106,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if (args->count() && executable.isEmpty()) {
|
if (args->count() && executable.isEmpty()) {
|
||||||
QString command = args->arg(0);
|
QString command = args->arg(0);
|
||||||
commandlist = command.split(" ");
|
QStringList commandlist = command.split(" ");
|
||||||
executable = commandlist[0];
|
executable = commandlist[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,19 +135,16 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* icon parsing */
|
/* icon parsing */
|
||||||
|
QString icon;
|
||||||
if (args->isSet("i")) {
|
if (args->isSet("i")) {
|
||||||
icon = args->getOption("i");
|
icon = args->getOption("i");
|
||||||
} else {
|
} else {
|
||||||
QString iconName = desktopFile->readIcon();
|
QString iconName = desktopFile->readIcon();
|
||||||
KIconLoader *loader = KIconLoader::global();
|
KIconLoader *loader = KIconLoader::global();
|
||||||
icon = loader->iconPath(iconName, -1 * KIconLoader::StdSizes(
|
icon = loader->iconPath(iconName, -1 * KIconLoader::StdSizes(KIconLoader::SizeHuge), true);
|
||||||
KIconLoader::SizeHuge), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* generic name parsing */
|
|
||||||
QString name = desktopFile->readName();
|
|
||||||
|
|
||||||
a.setQuitOnLastWindowClosed(false);
|
a.setQuitOnLastWindowClosed(false);
|
||||||
KdeSudo kdesudo(icon, name);
|
KdeSudo kdesudo(icon, desktopFile->readName());
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue