[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-workspace/apol/qmlrunner] krunner/interfaces/qmlrunner: small usability enhancements
From:       Aleix Pol <aleixpol () kde ! org>
Date:       2012-03-02 2:24:51
Message-ID: 20120302022451.2F062A60BB () git ! kde ! org
[Download RAW message or body]

Git commit 3c57cea08169f71ac1c6e471e4fd4687e240a836 by Aleix Pol.
Committed on 02/03/2012 at 03:24.
Pushed by apol into branch 'apol/qmlrunner'.

small usability enhancements

M  +17   -19   krunner/interfaces/qmlrunner/qml/main.qml
M  +1    -0    krunner/interfaces/qmlrunner/qmlrunnerview.cpp

http://commits.kde.org/kde-workspace/3c57cea08169f71ac1c6e471e4fd4687e240a836

diff --git a/krunner/interfaces/qmlrunner/qml/main.qml \
b/krunner/interfaces/qmlrunner/qml/main.qml index 9901b3d..1d2cf6e 100644
--- a/krunner/interfaces/qmlrunner/qml/main.qml
+++ b/krunner/interfaces/qmlrunner/qml/main.qml
@@ -24,20 +24,17 @@ import org.kde.qtextracomponents 0.1
 
 Item {
     width: 400
-    height: (inputRow.height+inputRow.anchors.margins+
-                (!contentItem.content || runnerModel.count==0 ? 0 : \
                (contentItem.content.childrenRect.height+contentItem.anchors.margins*2)))
                
-//     Rectangle {
-//         id: bg
-//         anchors.fill: parent
-//         color: "transparent"
-// //         opacity: .0
-// 
-//     }
+    height: (inputRow.height+
+                ((!contentItem.content || runnerModel.count==0) ? 0 : \
(contentItem.content.childrenRect.height+20))) +    
     id: main
     
     Connections {
         target: app
-        onChangeTerm: input.text=term
+        onChangeTerm: {
+            input.text=term
+            input.selectAll()
+        }
     }
     
     RunnerModels.RunnerModel { id: runnerModel }
@@ -50,7 +47,6 @@ Item {
             top: parent.top
             left: parent.left
             right: parent.right
-            margins: 10
         }
         
         ToolButton {
@@ -63,14 +59,13 @@ Item {
             iconSource: "plasma"
             id: changeStuff
             checkable: true
-            onClicked: setView("ResultsPath.qml")
+            onClicked: checked ? setView("ResultsPath.qml") : \
setView("ResultsList.qml")  }
         
         TextField {
             id: input
             onTextChanged: { runnerModel.query = text; \
contentItem.content.currentIndex = 0 }  width: 300
-            focus: true
             
             onAccepted: runnerModel.run(contentItem.content.currentIndex)
         }
@@ -93,10 +88,6 @@ Item {
         }
     }
     
-    Component.onCompleted: {
-        setView("ResultsList.qml")
-    }
-    
     Keys.onPressed: {
         if(event.key == Qt.Key_Tab || event.key == Qt.Key_Backtab) {
             var inc = (event.key == Qt.Key_Backtab) ? -1 : 1;
@@ -105,7 +96,10 @@ Item {
         }
     }
     
-    Keys.onEscapePressed: app.hide()
+    Keys.onEscapePressed: {
+        app.hide()
+        input.text=''
+    }
     
     Item {
         id: contentItem
@@ -114,12 +108,16 @@ Item {
             bottom: parent.bottom
             left: parent.left
             right: parent.right
-            margins: 10
         }
         clip: true
         
         property Item content
         
         onContentChanged: content.anchors.fill=contentItem
+        
+        Component.onCompleted: {
+            setView("ResultsList.qml")
+            input.selectAll()
+        }
     }
 }
diff --git a/krunner/interfaces/qmlrunner/qmlrunnerview.cpp \
b/krunner/interfaces/qmlrunner/qmlrunnerview.cpp index 7617be5..daebcfc 100644
--- a/krunner/interfaces/qmlrunner/qmlrunnerview.cpp
+++ b/krunner/interfaces/qmlrunner/qmlrunnerview.cpp
@@ -65,6 +65,7 @@ qmlrunnerView::qmlrunnerView(Plasma::RunnerManager* manager, \
QWidget *parent)  
     QVBoxLayout* layout = new QVBoxLayout(this);
     layout->addWidget(view);
+    view->setFocus();
     
     connect(view->rootObject(), SIGNAL(heightChanged()), SLOT(changeGeometry()));
     connect(qobject_cast<QDeclarativeItem*>(view->rootObject()), \
SIGNAL(implicitHeightChanged()), SLOT(changeGeometry()));


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic