summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command_line_options.cpp9
-rw-r--r--src/globals.cpp2
-rw-r--r--src/globals.h2
-rw-r--r--src/i18n/de.ts22
-rw-r--r--src/main.cpp9
-rw-r--r--src/vsession.cpp9
6 files changed, 40 insertions, 13 deletions
diff --git a/src/command_line_options.cpp b/src/command_line_options.cpp
index 4ee6520..61eb3ad 100644
--- a/src/command_line_options.cpp
+++ b/src/command_line_options.cpp
@@ -7,14 +7,16 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) {
static const struct option longOptions[] = {
{"config", required_argument, NULL, 'c'},
{"default", required_argument, NULL, 'd'},
+ {"pool", required_argument, NULL, 'P'},
{"path", required_argument, NULL, 'p'},
{"xpath", required_argument, NULL, 'x'},
{"size", required_argument, NULL, 's'},
{"version", no_argument, NULL, 'v'},
- {"help", no_argument, NULL, 'h'}
+ {"help", no_argument, NULL, 'h'},
+ {0, 0, 0, 0}
};
- int opt = getopt_long(argc, argv, "c:d:p:x:s:vhb", longOptions, NULL);
+ int opt = getopt_long(argc, argv, "c:d:P:p:x:s:vhb", longOptions, NULL);
if (opt == -1) break;
switch (opt) {
@@ -24,6 +26,9 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) {
case 'd':
options.insert("default", optarg);
break;
+ case 'P':
+ options.insert("pool", optarg);
+ break;
case 'p':
options.insert("path", optarg);
break;
diff --git a/src/globals.cpp b/src/globals.cpp
index 0606243..7dfc222 100644
--- a/src/globals.cpp
+++ b/src/globals.cpp
@@ -18,3 +18,5 @@ const QString globalConfFile(etcPath + "/vmchooser.conf");
const QString userConfFile(userPath + "/vmchooser.conf");
const QString previousSessionFile(userPath + "/vmchooser_prev_session");
+QString pool;
+
diff --git a/src/globals.h b/src/globals.h
index a505628..6ddf350 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -30,4 +30,6 @@ extern const QString globalConfFile;
extern const QString userConfFile;
extern const QString previousSessionFile;
+extern QString pool;
+
#endif
diff --git a/src/i18n/de.ts b/src/i18n/de.ts
index 85ceb14..c81a0fe 100644
--- a/src/i18n/de.ts
+++ b/src/i18n/de.ts
@@ -8,6 +8,7 @@
<source>Usage: vmchooser [ OPTIONS | FILE ]
-d, --default name of default session
+ -P, --pool name of the environment
-p, --path path to vmware .xml files
-x, --xpath path of X Session .desktop files
-s, --size window size &lt;width&gt;x&lt;height&gt;
@@ -16,41 +17,42 @@
FILE can be a vmware .xml or an X .desktop file
</source>
- <translation>Aufruf: vmchooser [ OPTIONEN | DATEI ]
+<translation>Aufruf: vmchooser [ OPTIONEN | DATEI ]
-d, --default Name der Standardsitzung
+ -P, --pool Name der Umgebung
-p, --path Pfad zu .xml-Dateien für virtuelle Sitzungen
-x, --xpath Pfad zu .desktop-Dateien für X Sitzungen
-s, --size Fenstergröße &lt;Breite&gt;x&lt;Höhe&gt;
-v, --version Version anzeigen und beenden
-h, --help Hilfetext anzeigen und beenden
-DATEI kann eine .xml- oder .desktop-Datei sein
+ DATEI kann eine .xml- oder .desktop-Datei sein
</translation>
</message>
<message>
- <location filename="../main.cpp" line="67"/>
- <location filename="../main.cpp" line="79"/>
+ <location filename="../main.cpp" line="68"/>
+ <location filename="../main.cpp" line="80"/>
<source>vmchooser: failed to run session</source>
<translation>vmchooser: Fehler beim Start der Sitzung</translation>
</message>
<message>
- <location filename="../main.cpp" line="84"/>
+ <location filename="../main.cpp" line="85"/>
<source>vmchooser: invalid session file</source>
<translation>vmchooser: ungültige Sitzungsdatei</translation>
</message>
<message>
- <location filename="../main.cpp" line="142"/>
+ <location filename="../main.cpp" line="143"/>
<source>vmchooser: invlid size argument</source>
<translation>vmchooser: ungültige Größenangabe</translation>
</message>
<message>
- <location filename="../main.cpp" line="159"/>
+ <location filename="../main.cpp" line="168"/>
<source>vmchooser: no sessions found</source>
<translation>vmchooser: keine Sitzungen gefunden</translation>
</message>
<message>
- <location filename="../main.cpp" line="171"/>
+ <location filename="../main.cpp" line="180"/>
<source>vmchooser: external script %1 is not executable</source>
<translation>vmchooser: externes Skript %1 ist nicht ausführbar</translation>
</message>
@@ -119,12 +121,12 @@ DATEI kann eine .xml- oder .desktop-Datei sein
<translation>Vmchooser konnte die gewählte Sitzung nicht ausführen!</translation>
</message>
<message>
- <location filename="../main.cpp" line="167"/>
+ <location filename="../main.cpp" line="176"/>
<source>X Sessions</source>
<translation>X-Sitzungen</translation>
</message>
<message>
- <location filename="../main.cpp" line="179"/>
+ <location filename="../main.cpp" line="188"/>
<source>Virtual Sessions</source>
<translation>Virtuelle Sitzungen</translation>
</message>
diff --git a/src/main.cpp b/src/main.cpp
index fbb3f67..faef051 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -33,6 +33,7 @@ int main(int argc, char *argv[]) {
"Console",
"Usage: vmchooser [ OPTIONS | FILE ]\n\n"
" -d, --default name of default session\n"
+ " -P, --pool name of the environment\n"
" -p, --path path to vmware .xml files\n"
" -x, --xpath path of X Session .desktop files\n"
" -s, --size window size <width>x<height>\n"
@@ -149,6 +150,14 @@ int main(int argc, char *argv[]) {
height = VMCHOOSER_DEFAULT_HEIGHT;
}
+ if (cmdOptions.contains("pool")) {
+ pool = cmdOptions.value("pool");
+ } else if (settings.contains("pool")) {
+ pool = settings.value("pool").toString();
+ } else if (settings.contains("vmchooser_env")) {
+ pool = settings.value("vmchooser_env").toString();
+ }
+
/* read session files */
QList<Session*> xsessions(XSession::readSessions(xSessionPath));
QList<Session*> vsessions(VSession::readXmlDir(vSessionPath));
diff --git a/src/vsession.cpp b/src/vsession.cpp
index d3c0296..edcd1e8 100644
--- a/src/vsession.cpp
+++ b/src/vsession.cpp
@@ -111,6 +111,12 @@ bool VSession::isActive() const {
}
}
+ if (!pool.isEmpty() &&
+ !getAttribute("pools").split("\\s*,\\s*").contains(pool)) {
+ // pools does not contain pool
+ return false;
+ }
+
return true;
}
@@ -182,7 +188,8 @@ void VSession::addUserAndHostname() {
QString image(this->getAttribute("image_name"));
if (QFileInfo(image).isRelative()) {
// make path to image absolute
- this->addNodeWithAttribute("image_name", this->baseDirPath_ + "/" + image);
+ this->addNodeWithAttribute("image_name",
+ this->baseDirPath_ + "/" + image);
}
// insert computername as the first child of <eintrag>