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

List:       kde-commits
Subject:    [kde-workspace/plasma/sreich/sal-lenses] plasma/netbook/containments/sal: make a proper anchor setup
From:       Shaun Reich <shaun.reich () kdemail ! net>
Date:       2012-02-24 20:49:15
Message-ID: 20120224204915.1BAA4A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 36235c253cdbe01ac253a9993d9342d65c3a0bfb by Shaun Reich.
Committed on 24/02/2012 at 21:48.
Pushed by sreich into branch 'plasma/sreich/sal-lenses'.

make a proper anchor setup, and it allows some decent filtering now

M  +19   -10   plasma/netbook/containments/sal/sal.cpp

http://commits.kde.org/kde-workspace/36235c253cdbe01ac253a9993d9342d65c3a0bfb

diff --git a/plasma/netbook/containments/sal/sal.cpp \
b/plasma/netbook/containments/sal/sal.cpp index 7d408e1..c64b673 100644
--- a/plasma/netbook/containments/sal/sal.cpp
+++ b/plasma/netbook/containments/sal/sal.cpp
@@ -56,6 +56,7 @@
 #include <Plasma/ScrollWidget>
 #include <Plasma/TabBar>
 #include <Plasma/ToolButton>
+#include <KServiceTypeTrader>
 
 
 SearchLaunch::SearchLaunch(QObject *parent, const QVariantList &args)
@@ -226,6 +227,10 @@ void SearchLaunch::init()
     searchLayout->addAnchors(m_backButton, searchLayout, Qt::Vertical);
     searchLayout->addAnchor(m_backButton, Qt::AnchorRight, m_searchField, \
Qt::AnchorLeft);  
+
+    QGraphicsAnchorLayout *filterLayout = new QGraphicsAnchorLayout();
+    filterLayout->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, \
QSizePolicy::Minimum)); +
     m_filterTabs = new Plasma::TabBar(this);
     m_filterTabs->addTab("All");
     m_filterTabs->addTab("Apps");
@@ -233,13 +238,12 @@ void SearchLaunch::init()
     m_filterTabs->addTab("Internet");
     connect(m_filterTabs, SIGNAL(currentChanged(int)), this, \
SLOT(filterTabsChanged(int)));  
-    searchLayout->addAnchor(m_filterTabs, Qt::AnchorTop, m_searchField, \
                Qt::AnchorBottom);
-    searchLayout->addAnchor(m_filterTabs, Qt::AnchorLeft, m_searchField, \
                Qt::AnchorLeft);
-    searchLayout->addAnchor(m_filterTabs, Qt::AnchorRight, m_searchField, \
                Qt::AnchorRight);
-
+    filterLayout->addAnchors(m_filterTabs, filterLayout, Qt::Vertical);
+    filterLayout->addAnchor(m_filterTabs, Qt::AnchorHorizontalCenter, filterLayout, \
Qt::AnchorHorizontalCenter);  
     // add our layouts to main vertical layout
     m_mainLayout->addItem(m_stripWidget);
+    m_mainLayout->addItem(filterLayout);
     m_mainLayout->addItem(searchLayout);
     m_mainLayout->addItem(m_resultsLayout);
 
@@ -758,25 +762,30 @@ void SearchLaunch::saveFavourites()
 void SearchLaunch::filterTabsChanged(int index)
 {
     QString chosenRunnerFilter;
+    Plasma::RunnerManager *manager = m_runnerModel->runnerManager();
 
-    // available tabs...
+    // Available Tabs:
     // All
     // Apps
     // Files
     // Internet
+
+    KService::List offers = KServiceTypeTrader::self()->query("Plasma/Runner");
+    QList<KPluginInfo> runnerInfo = KPluginInfo::fromServices(offers);
     switch(index) {
     case 0:
-  //      KService::List offers = \
                KServiceTypeTrader::self()->query("Plasma/Runner");
- //       QList<KPluginInfo> runnerInfo = KPluginInfo::fromServices(offers);
-//        m_runnerModel->runnerManager()->setAllowedRunners(runnerInfo);
         break;
 
     case 1:
-        m_runnerModel->runnerManager()->setAllowedRunners(QStringList() << \
"services"); +        manager->setAllowedRunners(QStringList() << "services");
         break;
 
     case 2:
-        m_runnerModel->runnerManager()->setAllowedRunners(QStringList() << "places" \
<< "solid" << "locations" << "recentdocuments"); +        \
manager->setAllowedRunners(QStringList() << "places" << "solid" << "locations" << \
"recentdocuments"); +        break;
+
+    case 3:
+        manager->setAllowedRunners(QStringList() << "wikipedia" << "webshortcuts" << \
"techbase" << "browserhistory");  break;
 
     default:


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

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