[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:06:05 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=b9aa6c7

The following commit has been merged in the master branch:
commit b9aa6c746e8bf2450be319f3bda3c3444aa4128d
Author: Rémy Greinhofer <remy.greinhofer at gmail.com>
Date:   Fri Apr 22 19:21:25 2011 +0200

    Adding a button to pin/unpin the filter bar to the contact list.
    
    The filter bar can get pinned to the contact list by clicking on the added button.
    This latter will have a different icon according to the state of the filter bar (pinned
    or unpinned) and will automatically get unpinned if the filter bar gets closed.
    
    BUG: 270476
    REVIEW: 101181
    Reviewed by: Martin Klapetek
---
 filter-bar.cpp  | 29 +++++++++++++++++++++++++++++
 filter-bar.h    | 32 +++++++++++++++++++++++++++++++-
 main-widget.cpp | 12 ++++++++++++
 3 files changed, 72 insertions(+), 1 deletion(-)

diff --git a/filter-bar.cpp b/filter-bar.cpp
index 13102f5..1d04ca8 100644
--- a/filter-bar.cpp
+++ b/filter-bar.cpp
@@ -32,12 +32,20 @@
 FilterBar::FilterBar(QWidget* parent) :
     QWidget(parent)
 {
+    // Create the pin button
+    m_pinButton = new QToolButton(this);
+    m_pinButton->setCheckable(true);
+    m_pinButton->setToolTip(i18n("Pin the filter bar"));
+    connect(m_pinButton, SIGNAL(clicked(bool)), this, SLOT(setPinned(bool)));
+    setPinned(false);
+
     // Create close button
     QToolButton *closeButton = new QToolButton(this);
     closeButton->setAutoRaise(true);
     closeButton->setIcon(KIcon("dialog-close"));
     closeButton->setToolTip(i18nc("@info:tooltip", "Hide Filter Bar"));
     connect(closeButton, SIGNAL(clicked()), this, SIGNAL(closeRequest()));
+    connect(closeButton, SIGNAL(clicked()), this, SLOT(unpinSlot()));
 
     // Create label
     QLabel* filterLabel = new QLabel(i18nc("@label:textbox", "Filter:"), this);
@@ -53,6 +61,7 @@ FilterBar::FilterBar(QWidget* parent) :
     // Apply layout
     QHBoxLayout* hLayout = new QHBoxLayout(this);
     hLayout->setMargin(0);
+    hLayout->addWidget(m_pinButton);
     hLayout->addWidget(closeButton);
     hLayout->addWidget(filterLabel);
     hLayout->addWidget(m_filterInput);
@@ -93,4 +102,24 @@ void FilterBar::keyReleaseEvent(QKeyEvent* event)
     }
 }
 
+bool FilterBar::isPinned() const
+{
+    return m_pinButton->isChecked();
+}
+
+void FilterBar::setPinned(bool pinned)
+{
+    if (pinned) {
+        m_pinButton->setIcon(KIcon("dialog-ok"));
+    } else {
+        m_pinButton->setIcon(KIcon("dialog-ok-apply"));
+    }
+    m_pinButton->setChecked(pinned);
+}
+
+void FilterBar::unpinSlot()
+{
+    setPinned(false);
+}
+
 #include "filter-bar.moc"
diff --git a/filter-bar.h b/filter-bar.h
index 9546c63..2acb724 100644
--- a/filter-bar.h
+++ b/filter-bar.h
@@ -23,6 +23,7 @@
 
 #include <QWidget>
 
+class QToolButton;
 class KLineEdit;
 
 /**
@@ -43,10 +44,31 @@ public:
      */
     void selectAll();
 
+    /**
+     * 
eturns true if the pin button is checked, false otherwise.
+     */
+    bool isPinned() const;
+
 public slots:
     /** Clears the input field. */
     void clear();
 
+    /**
+     * Sets the appearance of the pin button.
+     *
+     * Displays the pin button with a different icon according to its state
+     * (checked or unchecked).
+     *
+     * \param pinned if true, the pin button will be checked, otherwise it
+     * will be unchecked.
+     */
+    void setPinned(bool pinned);
+
+    /**
+     * Unpins the bar.
+     */
+    void unpinSlot();
+
 signals:
     /**
      * Signal that reports the name filter has been
@@ -64,7 +86,15 @@ protected:
     virtual void keyReleaseEvent(QKeyEvent* event);
 
 private:
-    KLineEdit* m_filterInput;
+    KLineEdit *m_filterInput;
+    /**
+     * Button to pin the filter bar to the contact list.
+     *
+     * The status of the button (checked or unchecked) will be written in the
+     * config file when the contact list gets closed, and the filter bar will
+     * shown or hidden accordingly next time the contact list is launched.
+     */
+    QToolButton *m_pinButton;
 };
 
 #endif
diff --git a/main-widget.cpp b/main-widget.cpp
index a100c05..4b877ab 100644
--- a/main-widget.cpp
+++ b/main-widget.cpp
@@ -223,10 +223,22 @@ MainWidget::MainWidget(QWidget *parent)
 
     connect(m_presenceMessageEdit, SIGNAL(returnPressed(QString)),
             this, SLOT(setCustomPresenceMessage(QString)));
+
+    KSharedConfigPtr config = KGlobal::config();
+    KConfigGroup filterBarGroup(config, "GUI");
+    if (filterBarGroup.readEntry("pin_filterbar", QString()) == QLatin1String("true")) {
+        toggleSearchWidget(true);
+        m_filterBar->setPinned(true);
+    }
 }
 
 MainWidget::~MainWidget()
 {
+    //save the state of the filter bar, pinned or not
+    KSharedConfigPtr config = KGlobal::config();
+    KConfigGroup filterBarGroup(config, "GUI");
+    filterBarGroup.writeEntry("pin_filterbar", m_filterBar->isPinned());
+    filterBarGroup.config()->sync();
 }
 
 void MainWidget::onAccountManagerReady(Tp::PendingOperation* op)

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list