Hello community,
here is the log from the commit of package kdeaddons3
checked in at Tue Jul 11 20:32:27 CEST 2006.
--------
--- KDE/kdeaddons3/kdeaddons3.changes 2006-06-19 15:01:56.000000000 +0200
+++ kdeaddons3/kdeaddons3.changes 2006-07-11 15:53:42.000000000 +0200
@@ -1,0 +2,6 @@
+Tue Jul 11 15:52:26 CEST 2006 - stbinner@suse.de
+
+- permanent visible searchbar in file mode offering Beagle search
+ (if beagled is running) and filtering of current file view
+
+-------------------------------------------------------------------
New:
----
permanent-searchbar.diff
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ kdeaddons3.spec ++++++
--- /var/tmp/diff_new_pack.YNPuT6/_old 2006-07-11 20:31:27.000000000 +0200
+++ /var/tmp/diff_new_pack.YNPuT6/_new 2006-07-11 20:31:27.000000000 +0200
@@ -20,7 +20,7 @@
Summary: Additional Modules for Kate, Kicker, Konqueror, and Noatun
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Version: 3.5.3
-Release: 5
+Release: 6
Url: http://www.kde.org
Requires: kdelibs3 >= %(rpm -q --queryformat '%{VERSION}' kdelibs3)
Source: kdeaddons-%{version}.tar.bz2
@@ -28,6 +28,7 @@
Patch1: disable-lnk.diff
Patch2: fix-kimgalleryplugin-output.diff
Patch3: google-suggest.diff
+Patch4: permanent-searchbar.diff
Provides: kdeaddons
%description
@@ -50,7 +51,7 @@
%package games
# usesubdirs atlantikdesigner
Version: 3.5.3
-Release: 5
+Release: 6
Provides: kdeaddons3 = %{version}-%{release}
Summary: Additional Modules for Atlantik
Group: System/GUI/KDE
@@ -72,7 +73,7 @@
Provides: kdeaddons3:/opt/kde3/share/apps/khtml/kpartplugins/plugin_babelfish.rc
Provides: kdeaddons3 = %{version}-%{release}
Version: 3.5.3
-Release: 5
+Release: 6
Summary: Konqueror Related Add-Ons
Group: Productivity/Networking/Web/Utilities
@@ -91,7 +92,7 @@
%package kontact
# usesubdirs kontact ksig
Version: 3.5.3
-Release: 5
+Release: 6
Requires: kdenetwork3-news
Provides: kdeaddons
Provides: kdeaddons3 = %{version}-%{release}
@@ -114,7 +115,7 @@
%package sound
# usesubdirs noatun-plugins
Version: 3.5.3
-Release: 5
+Release: 6
Provides: kdeaddons
Provides: kdeaddons3:/opt/kde3/bin/noatunsynaescope.bin
Provides: kdeaddons3 = %{version}-%{release}
@@ -134,7 +135,7 @@
%package kate
# usesubdirs kate
Version: 3.5.3
-Release: 5
+Release: 6
Provides: kdeaddons
Provides: kdeaddons3:/opt/kde3/bin/dcop_kate
Provides: kdeaddons3 = %{version}-%{release}
@@ -155,7 +156,7 @@
%package kicker
# usesubdirs kicker-applets
Version: 3.5.3
-Release: 5
+Release: 6
Provides: kdeaddons
Provides: kdeaddons3:/opt/kde3/share/apps/kicker/applets/ktimemon.desktop
Provides: kdeaddons3 = %{version}-%{release}
@@ -179,6 +180,7 @@
%patch1
%patch2
%patch3
+%patch4
. /etc/opt/kde3/common_options
update_admin
@@ -358,6 +360,9 @@
/opt/kde3/share/icons/*/*/*/ksig.*
%changelog -n kdeaddons3
+* Tue Jul 11 2006 - stbinner@suse.de
+- permanent visible searchbar in file mode offering Beagle search
+ (if beagled is running) and filtering of current file view
* Mon Jun 19 2006 - stbinner@suse.de
- add 3.5 branch diff for searchbar click hint texts
- add configuration menu for Google Suggest usage
++++++ permanent-searchbar.diff ++++++
Index: konq-plugins/dirfilter/dirfilterplugin.cpp
===================================================================
--- konq-plugins/dirfilter/dirfilterplugin.cpp (revision 560806)
+++ konq-plugins/dirfilter/dirfilterplugin.cpp (working copy)
@@ -19,6 +19,8 @@
#include
#include
+#include
+#include
#include
#include
#include
@@ -45,6 +47,8 @@
#include
#include
#include
+#include
+#include
#include "dirfilterplugin.h"
@@ -144,7 +148,10 @@
DirFilterPlugin::DirFilterPlugin (QObject* parent, const char* name,
const QStringList&)
:KParts::Plugin (parent, name),
+ m_beagled_running(true),
m_pFilterMenu(0),
+ m_popupMenu(0),
+ m_searchMode(Beagle),
m_searchWidget(0)
{
m_part = ::qt_cast(parent);
@@ -172,33 +179,30 @@
QHBox *hbox = new QHBox(m_part->widget());
hbox->hide();
- KAction *clear = new KAction(i18n("Clear Filter Field"),
+ m_clear = new KAction(i18n("Clear Filter Field"),
QApplication::reverseLayout() ? "clear_left" : "locationbar_erase",
0, 0, 0, actionCollection(), "clear_filter");
- clear->setWhatsThis(i18n("Clear filter field<p>Clears the content of the filter field."));
+ m_clear->setWhatsThis(i18n("Clear filter field<p>Clears the content of the filter field."));
- if ( ::qt_cast(m_part->scrollWidget()) )
- {
- m_searchWidget = new KListViewSearchLine(hbox);
- static_cast(m_searchWidget)->setListView(static_cast(m_part->scrollWidget()));
- }
- else if ( ::qt_cast(m_part->scrollWidget()) )
- {
- m_searchWidget = new KIconViewSearchLine(hbox);
- static_cast(m_searchWidget)->setIconView(static_cast(m_part->scrollWidget()));
- }
+ m_searchWidget = new SearchBarCombo(hbox, "search combo");
+ m_searchWidget->setDuplicatesEnabled(false);
+ m_searchWidget->setMaxCount(5);
+ m_searchWidget->setFixedWidth(180);
+ connect(m_searchWidget, SIGNAL(activated(const QString &)),
+ SLOT(startSearch(const QString &)));
+ connect(m_searchWidget, SIGNAL(iconClicked()), SLOT(showSelectionMenu()));
+ slotUseBeagle();
- if ( m_searchWidget )
- {
- QWhatsThis::add(m_searchWidget, i18n("Enter here a text which an item in the view must contain anywhere to be shown."));
- connect(clear, SIGNAL(activated()), m_searchWidget, SLOT(clear()));
- }
-
KWidgetAction *filterAction = new KWidgetAction(hbox, i18n("Filter Field"),
0, 0, 0, actionCollection(), "toolbar_filter_field");
filterAction->setShortcutConfigurable(false);
+
+ setIcon();
+
+ KIO::SimpleJob *job = KIO::stat("beagle:?beagled-status", FALSE);
+ connect(job, SIGNAL(result(KIO::Job *)), SLOT(slotStatResult(KIO::Job *)));
}
DirFilterPlugin::~DirFilterPlugin()
@@ -206,6 +210,15 @@
delete m_pFilterMenu;
}
+void DirFilterPlugin::startSearch(const QString &search)
+{
+ if( m_searchMode == Filter )
+ return;
+
+ emit m_part->extension()->openURLRequest("beagle:"+search);
+}
+
+
void DirFilterPlugin::slotOpenURL ()
{
KURL url = m_part->url();
@@ -218,12 +231,13 @@
//Clears the hidden list which is by now outdated...
if (m_searchWidget)
{
- SessionManager::self()->save(m_pURL, m_searchWidget->text());
+ SessionManager::self()->save(m_pURL, m_searchWidget->lineEdit()->text());
m_searchWidget->clear();
QString typedFilter(SessionManager::self()->restoreTypedFilter(url));
m_searchWidget->completionObject()->addItem(typedFilter);
- m_searchWidget->setText(typedFilter);
+ m_searchWidget->lineEdit()->setText(typedFilter);
+ setIcon();
}
m_pURL = url;
@@ -485,6 +499,173 @@
m_part->openURL (m_part->url());
}
+void DirFilterPlugin::setIcon()
+{
+ QString hinttext;
+ QPixmap m_searchIcon;
+ if (m_searchMode == Filter) {
+ m_searchIcon = SmallIcon("filter");
+ hinttext = i18n("Filter This Folder");
+ }
+ else {
+ m_searchIcon = SmallIcon("kerry");
+ hinttext = i18n("Search Index");
+ }
+
+ if (m_beagled_running) {
+ // Create a bit wider icon with arrow
+ QPixmap arrowmap = QPixmap(m_searchIcon.width()+5,m_searchIcon.height()+5);
+ arrowmap.fill(m_searchWidget->lineEdit()->backgroundColor());
+ QPainter p( &arrowmap );
+ p.drawPixmap(0, 2, m_searchIcon);
+ QStyle::SFlags arrowFlags = QStyle::Style_Default;
+ m_searchWidget->style().drawPrimitive(QStyle::PE_ArrowDown, &p, QRect(arrowmap.width()-6,
+ arrowmap.height()-6, 6, 5), m_searchWidget->colorGroup(), arrowFlags, QStyleOption() );
+ p.end();
+ m_searchIcon = arrowmap;
+ }
+
+ m_searchWidget->setIcon(m_searchIcon);
+ static_cast(m_searchWidget->lineEdit())->setClickMessage(hinttext);
+}
+
+void DirFilterPlugin::showSelectionMenu()
+{
+ if (!m_beagled_running)
+ return;
+
+ if(!m_popupMenu)
+ {
+ m_popupMenu = new QPopupMenu(m_searchWidget, "search mode selection");
+ m_popupMenu->insertItem(SmallIcon("kerry"), i18n("Search Index"), this, SLOT(slotUseBeagle()));
+ m_popupMenu->insertItem(SmallIcon("filter"), i18n("Filter This Folder"), this, SLOT(slotUseFilter()));
+ }
+ m_popupMenu->popup(m_searchWidget->mapToGlobal(QPoint(0, m_searchWidget->height() + 1)), 0);
+}
+
+void DirFilterPlugin::slotUseBeagle()
+{
+ m_searchMode = Beagle;
+ m_searchWidget->setLineEdit(new KLineEdit(m_searchWidget));
+ m_searchWidget->lineEdit()->installEventFilter(this);
+ m_searchWidget->setFocus();
+ QWhatsThis::add(m_searchWidget->lineEdit(), i18n("Enter here a text which shall be searched on the whole system in the Beagle index."));
+ connect(m_clear, SIGNAL(activated()), m_searchWidget->lineEdit(), SLOT(clear()));
+ setIcon();
+}
+
+void DirFilterPlugin::slotUseFilter()
+{
+ switchToFilter();
+ m_searchWidget->setFocus();
+}
+
+void DirFilterPlugin::switchToFilter()
+{
+ m_searchMode = Filter;
+ if ( ::qt_cast(m_part->scrollWidget()) ) {
+ KListViewSearchLine* searchlineWidget = new KListViewSearchLine(m_searchWidget);
+ m_searchWidget->setLineEdit(searchlineWidget);
+ searchlineWidget->setListView(static_cast(m_part->scrollWidget()));
+ }
+ else if ( ::qt_cast(m_part->scrollWidget()) ) {
+ KIconViewSearchLine* searchlineWidget = new KIconViewSearchLine(m_searchWidget);
+ m_searchWidget->setLineEdit(searchlineWidget);
+ searchlineWidget->setIconView(static_cast(m_part->scrollWidget()));
+ }
+ m_searchWidget->lineEdit()->installEventFilter(this);
+ QWhatsThis::add(m_searchWidget->lineEdit(), i18n("Enter here a text which an item in the view must contain anywhere to be shown."));
+ connect(m_clear, SIGNAL(activated()), m_searchWidget->lineEdit(), SLOT(clear()));
+ setIcon();
+}
+
+void DirFilterPlugin::slotStatResult(KIO::Job * job)
+{
+ if (job->error()) {
+ kdDebug() << "no beagled running" << endl;
+ m_beagled_running = false;
+ switchToFilter();
+ QFocusEvent fe( QEvent::FocusOut );
+ QApplication::sendEvent( m_searchWidget->lineEdit(), &fe );
+ }
+}
+
+SearchBarCombo::SearchBarCombo(QWidget *parent, const char *name) :
+ KHistoryCombo(parent, name),
+ m_pluginActive(true)
+{
+ connect(this, SIGNAL(cleared()), SLOT(historyCleared()));
+}
+
+const QPixmap &SearchBarCombo::icon() const
+{
+ return m_icon;
+}
+
+void SearchBarCombo::setIcon(const QPixmap &icon)
+{
+ m_icon = icon;
+
+ if(count() == 0)
+ {
+ insertItem(m_icon, 0);
+ }
+ else
+ {
+ for(int i = 0; i < count(); i++)
+ {
+ changeItem(m_icon, text(i), i);
+ }
+ }
+}
+
+int SearchBarCombo::findHistoryItem(const QString &searchText)
+{
+ for(int i = 0; i < count(); i++)
+ {
+ if(text(i) == searchText)
+ {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+void SearchBarCombo::mousePressEvent(QMouseEvent *e)
+{
+ int x0 = QStyle::visualRect( style().querySubControlMetrics( QStyle::CC_ComboBox, this, QStyle::SC_ComboBoxEditField ), this ).x();
+
+ if(e->x() > x0 + 2 && e->x() < lineEdit()->x())
+ {
+ emit iconClicked();
+
+ e->accept();
+ }
+ else
+ {
+ KHistoryCombo::mousePressEvent(e);
+ }
+}
+
+void SearchBarCombo::historyCleared()
+{
+ setIcon(m_icon);
+}
+
+void SearchBarCombo::setPluginActive(bool pluginActive)
+{
+ m_pluginActive = pluginActive;
+}
+
+void SearchBarCombo::show()
+{
+ if(m_pluginActive)
+ {
+ KHistoryCombo::show();
+ }
+}
+
typedef KGenericFactory<DirFilterPlugin> DirFilterFactory;
K_EXPORT_COMPONENT_FACTORY (libdirfilterplugin, DirFilterFactory("dirfilterplugin"))
Index: konq-plugins/dirfilter/dirfilterplugin.rc
===================================================================
--- konq-plugins/dirfilter/dirfilterplugin.rc (revision 560806)
+++ konq-plugins/dirfilter/dirfilterplugin.rc (working copy)
@@ -9,5 +9,6 @@
<Action name="filterdir"/>
</ToolBar>
<ToolBar fullWidth="true" name="locationToolBar" newline="true"><text>Filter Toolbar</text>
+ <Action name="toolbar_filter_field" />
</ToolBar>
</kpartplugin>
Index: konq-plugins/dirfilter/dirfilterplugin.h
===================================================================
--- konq-plugins/dirfilter/dirfilterplugin.h (revision 560806)
+++ konq-plugins/dirfilter/dirfilterplugin.h (working copy)
@@ -27,10 +27,13 @@
#include
#include
#include
+#include
class KActionMenu;
class KonqDirPart;
class KLineEdit;
+class SearchBarCombo;
+class QPopupMenu;
namespace KParts
@@ -108,6 +111,7 @@
void loadSettings();
void saveSettings();
+ void setIcon();
private slots:
void slotReset();
@@ -119,14 +123,88 @@
void slotItemSelected(int);
void slotItemRemoved(const KFileItem *);
void slotItemsAdded(const KFileItemList &);
+ void showSelectionMenu();
+ void slotUseBeagle();
+ void slotUseFilter();
+ void startSearch(const QString &search);
+ void slotStatResult(KIO::Job *job);
private:
+ void switchToFilter();
+
+ /** Possible search modes */
+ enum SearchModes { Beagle = 0, Filter };
+
+ bool m_beagled_running;
KURL m_pURL;
KonqDirPart* m_part;
KActionMenu* m_pFilterMenu;
+ QPopupMenu* m_popupMenu;
+ SearchModes m_searchMode;
+ KAction *m_clear;
- KLineEdit *m_searchWidget;
+ SearchBarCombo *m_searchWidget;
QMap m_pMimeInfo;
typedef QMap::Iterator MimeInfoIterator;
};
+
+/**
+ * Combo box which catches mouse clicks on the pixmap.
+ */
+class SearchBarCombo : public KHistoryCombo
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * Constructor.
+ */
+ SearchBarCombo(QWidget *parent, const char *name);
+
+ /**
+ * Returns the icon currently displayed in the combo box.
+ */
+ const QPixmap &icon() const;
+
+ /**
+ * Sets the icon displayed in the combo box.
+ */
+ void setIcon(const QPixmap &icon);
+
+ /**
+ * Finds a history item by its text.
+ * @return The item number, or -1 if the item is not found.
+ */
+ int findHistoryItem(const QString &text);
+
+ /**
+ * Sets whether the plugin is active. It can be inactive
+ * in case the current Konqueror part isn't a KHTML part.
+ */
+ void setPluginActive(bool pluginActive);
+
+ public slots:
+ virtual void show();
+
+ signals:
+ /**
+ * Emitted when the icon was clicked.
+ */
+ void iconClicked();
+
+ protected:
+ /**
+ * Captures mouse clicks and emits iconClicked() if the icon
+ * was clicked.
+ */
+ virtual void mousePressEvent(QMouseEvent *e);
+
+ private slots:
+ void historyCleared();
+
+ private:
+ QPixmap m_icon;
+ bool m_pluginActive;
+};
+
#endif
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit-unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit-help@opensuse.org