mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kiconfinder: format and indent
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
a79c074652
commit
3705256bc4
1 changed files with 22 additions and 24 deletions
|
@ -30,61 +30,59 @@
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
KCmdLineArgs::init(argc, argv,
|
||||
"kiconfinder",
|
||||
0,
|
||||
ki18n("Icon Finder"),
|
||||
KDE_VERSION_STRING,
|
||||
ki18n("Finds an icon based on its name")
|
||||
);
|
||||
|
||||
KCmdLineArgs::init(
|
||||
argc, argv,
|
||||
"kiconfinder",
|
||||
0,
|
||||
ki18n("Icon Finder"),
|
||||
KDE_VERSION_STRING,
|
||||
ki18n("Finds an icon based on its name")
|
||||
);
|
||||
|
||||
KCmdLineOptions options;
|
||||
|
||||
options.add("+iconname", ki18n("The icon name to look for"));
|
||||
options.add("icongroup <group>", ki18n("The icon group to look in"), "desktop");
|
||||
|
||||
KCmdLineArgs::addCmdLineOptions( options );
|
||||
|
||||
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
|
||||
|
||||
if(args->count() < 1) {
|
||||
if (args->count() < 1) {
|
||||
args->usage();
|
||||
}
|
||||
|
||||
QStringList iconArgs;
|
||||
for (int i=0; i<args->count(); i++) {
|
||||
for (int i = 0; i<args->count(); i++) {
|
||||
iconArgs << args->arg(i);
|
||||
}
|
||||
const QString groupArg = args->getOption("icongroup");
|
||||
|
||||
KIconLoader::Group iconGroup;
|
||||
if(groupArg == "none")
|
||||
if (groupArg == "none") {
|
||||
iconGroup = KIconLoader::NoGroup;
|
||||
else if(groupArg == "desktop")
|
||||
} else if (groupArg == "desktop") {
|
||||
iconGroup = KIconLoader::Desktop;
|
||||
else if(groupArg == "first")
|
||||
} else if(groupArg == "first") {
|
||||
iconGroup = KIconLoader::FirstGroup;
|
||||
else if(groupArg == "toolbar")
|
||||
} else if(groupArg == "toolbar") {
|
||||
iconGroup = KIconLoader::MainToolbar;
|
||||
else if(groupArg == "small")
|
||||
} else if(groupArg == "small") {
|
||||
iconGroup = KIconLoader::Small;
|
||||
else if(groupArg == "panel")
|
||||
} else if(groupArg == "panel") {
|
||||
iconGroup = KIconLoader::Panel;
|
||||
else if(groupArg == "dialog")
|
||||
} else if(groupArg == "dialog") {
|
||||
iconGroup = KIconLoader::Dialog;
|
||||
else if(groupArg == "last")
|
||||
} else if(groupArg == "last") {
|
||||
iconGroup = KIconLoader::LastGroup;
|
||||
else if(groupArg == "user")
|
||||
} else if(groupArg == "user") {
|
||||
iconGroup = KIconLoader::User;
|
||||
else {
|
||||
std::cerr << "Invalid icon group '" << groupArg.toLatin1().constData() << ","<< std::endl;
|
||||
} else {
|
||||
std::cerr << "Invalid icon group '" << groupArg.toLatin1().constData() << "," << std::endl;
|
||||
std::cerr << "Choose one of: none, desktop, first, toolbar, small, panel, dialog, last, user." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int rv = 0;
|
||||
foreach(const QString iconName, iconArgs) {
|
||||
foreach (const QString iconName, iconArgs) {
|
||||
const QString icon = KIconLoader::global()->iconPath(iconName, iconGroup, true);
|
||||
if (!icon.isEmpty()) {
|
||||
printf("%s\n", icon.toLatin1().constData());
|
||||
|
|
Loading…
Add table
Reference in a new issue