~ubuntu-branches/ubuntu/quantal/kde-baseapps/quantal

1 by Philip Muškovac
Import upstream version 4.6.90
1
/* This file is part of the KDE project
2
   Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
3
4
   This library is free software; you can redistribute it and/or
5
   modify it under the terms of the GNU Library General Public
6
   License as published by the Free Software Foundation; either
7
   version 2 of the License, or (at your option) any later version.
8
9
   This library is distributed in the hope that it will be useful,
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
   Library General Public License for more details.
13
14
   You should have received a copy of the GNU Library General Public License
15
   along with this library; see the file COPYING.LIB.  If not, write to
16
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
   Boston, MA 02110-1301, USA.
18
*/
19
20
#ifndef __konq_actions_h__
21
#define __konq_actions_h__
22
23
#include <ktoolbarpopupaction.h>
24
#include <konqhistorymanager.h>
25
#include <kactionmenu.h>
1.1.12 by Philip Muškovac
Import upstream version 4.8.80a
26
#include <QWidget>
1 by Philip Muškovac
Import upstream version 4.6.90
27
#include <QtCore/QList>
28
29
struct HistoryEntry;
30
class QMenu;
31
32
namespace KonqActions {
33
    void fillHistoryPopup(const QList<HistoryEntry*> &history, int historyIndex,
34
                          QMenu * popup,
35
                          bool onlyBack,
36
                          bool onlyForward);
37
}
38
39
#if 0
40
/**
41
 * Plug this action into a menu to get a bidirectional history
42
 * (both back and forward, including current location)
43
 */
44
class KonqBidiHistoryAction : public KToolBarPopupAction
45
{
46
  Q_OBJECT
47
public:
48
    KonqBidiHistoryAction( const QString & text, QObject * parent );
49
    virtual ~KonqBidiHistoryAction();
50
51
    void fillGoMenu( const QList<HistoryEntry*> &history, int historyIndex );
52
53
protected Q_SLOTS:
54
    void slotTriggered( QAction* action );
55
56
Q_SIGNALS:
57
    void menuAboutToShow();
58
    // -1 for one step back, 0 for don't move, +1 for one step forward, etc.
59
    void step( int );
60
private:
61
    int m_startPos;
62
    int m_currentPos; // == history.at()
63
};
64
65
#endif
66
67
/////
68
69
class KonqMostOftenURLSAction : public KActionMenu
70
{
71
    Q_OBJECT
72
73
public:
74
    KonqMostOftenURLSAction( const QString& text, QObject* parent );
75
    virtual ~KonqMostOftenURLSAction();
76
77
    static bool numberOfVisitOrder( const KonqHistoryEntry& lhs, const KonqHistoryEntry& rhs ) {
78
        return lhs.numberOfTimesVisited < rhs.numberOfTimesVisited;
79
    }
80
81
Q_SIGNALS:
82
    void activated(const KUrl&);
83
84
private Q_SLOTS:
85
    void slotHistoryCleared();
86
    void slotEntryAdded( const KonqHistoryEntry& entry );
87
    void slotEntryRemoved( const KonqHistoryEntry& entry );
88
89
    void slotFillMenu();
90
    void slotActivated(QAction* action);
91
92
private:
93
    void init();
94
    void parseHistory();
95
    static void inSort( const KonqHistoryEntry& entry );
96
    bool m_parsingDone;
97
};
98
99
/////
100
101
class KonqHistoryAction : public KActionMenu
102
{
103
    Q_OBJECT
104
105
public:
106
    KonqHistoryAction(const QString& text, QObject* parent);
107
    virtual ~KonqHistoryAction();
108
109
Q_SIGNALS:
110
    void activated(const KUrl&);
111
112
private Q_SLOTS:
113
    void slotFillMenu();
114
    void slotActivated(QAction* action);
115
};
116
117
#endif