[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bkonsole=5D_src=3A_Add_command-line_option_--list-pr?=
From: Kurt Hindenburg <kurt.hindenburg () gmail ! com>
Date: 2011-03-01 1:31:46
Message-ID: 20110301013146.B9EE1A60C9 () git ! kde ! org
[Download RAW message or body]
Git commit 78f0d054ff14825da2689548208061d6f8680386 by Kurt Hindenburg.
Committed on 01/03/2011 at 02:19.
Pushed by hindenburg into branch 'master'.
Add command-line option --list-profile-properties
This new option will list all the profile properties' name and type.
This info can then be used with the -p name=value; command line option.
M +14 -0 src/Application.cpp
M +1 -0 src/Application.h
M +13 -0 src/Profile.cpp
M +5 -0 src/Profile.h
M +1 -0 src/main.cpp
http://commits.kde.org/konsole/78f0d054ff14825da2689548208061d6f8680386
diff --git a/src/Application.cpp b/src/Application.cpp
index 51554c1..d545d59 100644
--- a/src/Application.cpp
+++ b/src/Application.cpp
@@ -101,6 +101,15 @@ void Application::listAvailableProfiles()
quit();
}
+void Application::listProfilePropertyInfo()
+{
+ Profile::Ptr tempProfile = SessionManager::instance()->defaultProfile();
+ const QStringList names = tempProfile->propertiesInfoList();
+ for (int i = 0; i < names.size(); ++i)
+ std::cout << names.at(i).toLocal8Bit().data() << std::endl;
+ quit();
+}
+
int Application::newInstance()
{
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
@@ -308,6 +317,11 @@ bool Application::processHelpArgs(KCmdLineArgs* args)
listAvailableProfiles();
return true;
}
+ else if ( args->isSet("list-profile-properties") )
+ {
+ listProfilePropertyInfo();
+ return true;
+ }
return false;
}
void Application::processProfileChangeArgs(KCmdLineArgs* args,MainWindow* window)
diff --git a/src/Application.h b/src/Application.h
index df7a8b5..d9014cb 100644
--- a/src/Application.h
+++ b/src/Application.h
@@ -80,6 +80,7 @@ private slots:
private:
void init();
void listAvailableProfiles();
+ void listProfilePropertyInfo();
void startBackgroundMode(MainWindow* window);
bool processHelpArgs(KCmdLineArgs* args);
MainWindow* processWindowArgs(KCmdLineArgs* args);
diff --git a/src/Profile.cpp b/src/Profile.cpp
index aa67d28..47e45fc 100644
--- a/src/Profile.cpp
+++ b/src/Profile.cpp
@@ -291,6 +291,19 @@ int Profile::menuIndexAsInt() const
return 0;
}
+const QStringList Profile::propertiesInfoList() const
+{
+ QStringList info;
+ const PropertyInfo* iter = DefaultPropertyNames;
+ while ( iter->name != 0 )
+ {
+ info << QString(iter->name) + " : " + \
QString(QVariant(iter->type).typeName()); + iter++;
+ }
+
+ return info;
+}
+
QString KDE4ProfileWriter::getPath(const Profile::Ptr info)
{
QString newPath;
diff --git a/src/Profile.h b/src/Profile.h
index 3555166..8aa6dfc 100644
--- a/src/Profile.h
+++ b/src/Profile.h
@@ -370,6 +370,11 @@ public:
int menuIndexAsInt() const;
+ /** Return a list of all properties names and their type
+ * (for use with -p option).
+ */
+ const QStringList propertiesInfoList() const;
+
/**
* Returns true if @p name has been associated with an element
* from the Property enum or false otherwise.
diff --git a/src/main.cpp b/src/main.cpp
index bb4a032..56993a7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -104,6 +104,7 @@ void fillCommandLineOptions(KCmdLineOptions& options)
options.add("noclose",ki18n("Do not close the initial session automatically when \
it ends.")); // TODO - Document this option more clearly
options.add("p <property=value>",ki18n("Change the value of a profile \
property.")); + options.add("list-profile-properties", ki18n("List all the profile \
propertes names and their type (for use with -p)")); options.add("!e \
<cmd>",ki18n("Command to execute")); options.add("+[args]",ki18n("Arguments passed \
to command")); }
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic