1 // -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*-
2 /* This file is part of the KDE project
3 Copyright (C) 2004 Esben Mose Hansen <kde@mosehansen.dk>
4 Copytight (C) by Andrew Stanley-Jones
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
20 #ifndef KLIPPERPOPUP_H
21 #define KLIPPERPOPUP_H
24 #include <QWidgetAction>
35 * Default view of clipboard history.
38 class KlipperPopup
: public KMenu
43 explicit KlipperPopup( History
* history
);
45 void plugAction( QAction
* action
);
48 * Normally, the popupmenu is only rebuilt just before showing.
49 * If you need the pixel-size or similar of the this menu, call
54 History
* history() { return m_history
; }
55 const History
* history() const { return m_history
; }
58 void slotHistoryChanged() { m_dirty
= true; }
59 void slotAboutToShow();
62 void rebuild( const QString
& filter
= QString() );
63 void buildFromScratch();
65 void insertSearchFilter();
66 void removeSearchFilter();
69 virtual void keyPressEvent( QKeyEvent
* e
);
72 bool m_dirty
: 1; // true if menu contents needs to be rebuild.
75 * Contains the string shown if the menu is empty.
80 * Contains the string shown if the search string has no
81 * matches and the menu is not empty.
86 * The "document" (clipboard history)
93 KHelpMenu
* m_helpmenu
;
96 * (unowned) actions to plug into the primary popup menu
98 QList
<QAction
*> m_actions
;
101 * Proxy helper object used to track history items
103 PopupProxy
* m_popupProxy
;
106 * search filter widget
108 KLineEdit
* m_filterWidget
;
111 * Action of search widget
113 QWidgetAction
*m_filterWidgetAction
;
116 * The current number of history items in the clipboard