[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [plasmate/terietor/tools] plasmoidviewer: get rid of gotos
From: Marco Martin <notmart () gmail ! com>
Date: 2012-08-16 18:41:51
Message-ID: 20120816184151.C0899A610A () git ! kde ! org
[Download RAW message or body]
Git commit 54f98ad21dd767cb4e15554c93e27ade238213c2 by Marco Martin.
Committed on 22/02/2012 at 18:14.
Pushed by tsiapaliwkas into branch 'terietor/tools'.
get rid of gotos
M +26 -21 plasmoidviewer/main.cpp
http://commits.kde.org/plasmate/54f98ad21dd767cb4e15554c93e27ade238213c2
diff --git a/plasmoidviewer/main.cpp b/plasmoidviewer/main.cpp
index 8998b1a..a3786f3 100644
--- a/plasmoidviewer/main.cpp
+++ b/plasmoidviewer/main.cpp
@@ -189,22 +189,24 @@ int main(int argc, char **argv)
KPluginInfo::List appletList = Plasma::Applet::listAppletInfo();
+ bool appletFound = false;
foreach (const KPluginInfo& info, appletList) {
if (info.pluginName() == pluginName) {
- goto appletFound;
+ appletFound = true;
+ break;
}
}
- kError() << "Fatal error. Applet: " + pluginName +
- " is invalid. Did you run kbuildsycoca4? List known containments through \
--list";
- kError() << "Note: only accepts applet Plugin Name (visible through --list), \
not user-visible name";
- return 1;
+ if (!appletFound) {
+ kError() << "Fatal error. Applet: " + pluginName +
+ " is invalid. Did you run kbuildsycoca4? List known containments \
through --list"; + kError() << "Note: only accepts applet Plugin Name \
(visible through --list), not user-visible name"; + return 1;
+ }
}
-appletFound:
-
QString formfactor = args->getOption("formfactor");
kDebug() << "setting FormFactor to" << args->getOption("formfactor");
@@ -218,22 +220,24 @@ appletFound:
KPluginInfo::List containmentList = Plasma::Containment::listContainments();
+ bool containmentFound = false;
foreach (const KPluginInfo& info, containmentList) {
if (info.pluginName() == containment) {
- goto containmentFound;
+ containmentFound = true;
+ break;
}
}
- kError() << "Fatal error. Containment: " + containment +
- " is invalid. Did you run kbuildsycoca4? List known containments through \
--list-containments";
- kError() << "Note: only accepts containment Plugin Name (visible through \
--list-containments), not user-visible name";
- return 1;
+ if (!containmentFound) {
+ kError() << "Fatal error. Containment: " + containment +
+ " is invalid. Did you run kbuildsycoca4? List known containments \
through --list-containments"; + kError() << "Note: only accepts \
containment Plugin Name (visible through --list-containments), not user-visible \
name"; + return 1;
+ }
}
-containmentFound:
-
if (args->isSet("theme")) {
QString themeName = args->getOption("theme");
@@ -241,6 +245,7 @@ containmentFound:
KPluginInfo::List themeList = Plasma::Theme::listThemeInfo();
+ bool themeFound = false;
foreach (const KPluginInfo& info, themeList) {
if (info.pluginName() == themeName) {
@@ -250,19 +255,19 @@ containmentFound:
defaultTheme->setThemeName(themeName);
- goto themeFound;
+ themeFound = true;
}
}
- kError() << "Fatal error. Theme: " + themeName +
- " is invalid. Did you run kbuildsycoca4? List known themes through \
--list-themes";
- kError() << "Note: only accepts theme Plugin Name (visible through \
--list-themes), not user-visible name";
- return 1;
+ if (!themeFound) {
+ kError() << "Fatal error. Theme: " + themeName +
+ " is invalid. Did you run kbuildsycoca4? List known themes through \
--list-themes"; + kError() << "Note: only accepts theme Plugin Name \
(visible through --list-themes), not user-visible name"; + return 1;
+ }
}
-themeFound:
-
QString wallpaper;
if (args->isSet("wallpaper")) {
wallpaper = args->getOption("wallpaper");
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic