[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: [patch] Minicli shows app descriptions
From: Unai Garro <ugarro () telefonica ! net>
Date: 2004-12-06 21:26:42
Message-ID: 200412062226.42770.ugarro () telefonica ! net
[Download RAW message or body]
I found a feature like this would improve minicli's usability. With the
attached patch, when a command is typed in, it shows the name and description
of the application you're about to run. See the screenie and patch for a
better description ;)
The patch leaves the text empty when it refers to services other than
applications, but it should be easily tweaked to show any info when a url,
dir or whatever is typed in.
regards,
Unai
["minicli.png" (image/png)]
["minicli.patch" (text/x-diff)]
? minicli_ui.ui_back
Index: minicli.cpp
===================================================================
RCS file: /home/kde/kdebase/kdesktop/minicli.cpp,v
retrieving revision 1.187
diff -u -3 -p -u -r1.187 minicli.cpp
--- minicli.cpp 18 Nov 2004 20:18:26 -0000 1.187
+++ minicli.cpp 6 Dec 2004 21:28:27 -0000
@@ -675,6 +675,31 @@ void Minicli::parseLine( bool final )
if (!wasAutoChecked && willBeAutoChecked)
m_autoCheckedRunInTerm = true;
}
+
+
+ if (m_filterData->uriType()==KURIFilterData::EXECUTABLE)
+ {
+ // Look for desktop file
+ KService::Ptr service = KService::serviceByDesktopName(cmd);
+ if (service && service->isValid() && service->type() == "Application")
+ {
+ QString description =service->genericName();
+ QString name=service->name();
+
+ //If there is no genericName, try with the comment
+ if (description==QString::null || description=="")
+ description=service->comment();
+
+ if (description==QString::null) description="";
+
+ if (name!=QString::null && name !="") description=name+QString(": ")+description;
+ m_dlg->lbDescription->setText(description);
+ }
+ }
+ else
+ {
+ m_dlg->lbDescription->setText("");
+ }
kdDebug (1207) << "Command: " << m_filterData->uri().url() << endl;
kdDebug (1207) << "Arguments: " << m_filterData->argsAndOptions() << endl;
Index: minicli_ui.ui
===================================================================
RCS file: /home/kde/kdebase/kdesktop/minicli_ui.ui,v
retrieving revision 1.27
diff -u -3 -p -u -r1.27 minicli_ui.ui
--- minicli_ui.ui 13 Jul 2004 22:10:12 -0000 1.27
+++ minicli_ui.ui 6 Dec 2004 21:28:28 -0000
@@ -24,7 +24,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="2">
+ <widget class="QLayoutWidget" row="5" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>layout4</cstring>
</property>
@@ -102,7 +102,7 @@
</widget>
</hbox>
</widget>
- <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2">
+ <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>layout4</cstring>
</property>
@@ -432,7 +432,7 @@
</widget>
</hbox>
</widget>
- <widget class="QFrame" row="3" column="0" rowspan="1" colspan="2">
+ <widget class="QFrame" row="4" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>separator</cstring>
</property>
@@ -451,7 +451,7 @@
<enum>Sunken</enum>
</property>
</widget>
- <widget class="QLabel" row="1" column="0">
+ <widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>lbCommand</cstring>
</property>
@@ -476,7 +476,7 @@
<set>AlignCenter</set>
</property>
</widget>
- <widget class="KHistoryCombo" row="1" column="1">
+ <widget class="KHistoryCombo" row="2" column="1">
<property name="name">
<cstring>cbCommand</cstring>
</property>
@@ -511,6 +511,25 @@
<set>WordBreak|AlignVCenter</set>
</property>
</widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>lbDescription</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter</set>
+ </property>
+ </widget>
</grid>
</widget>
<connections>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic