~ubuntu-branches/ubuntu/warty/kdebase/warty

« back to all changes in this revision

Viewing changes to konqueror/konq_actions.h

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-09-16 04:51:45 UTC
  • Revision ID: james.westby@ubuntu.com-20040916045145-9vr63kith3k1cpza
Tags: upstream-3.2.2
ImportĀ upstreamĀ versionĀ 3.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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., 59 Temple Place - Suite 330,
 
17
   Boston, MA 02111-1307, USA.
 
18
*/
 
19
 
 
20
#ifndef __konq_actions_h__
 
21
#define __konq_actions_h__ "$Id: konq_actions.h,v 1.46 2003/11/14 00:23:41 faure Exp $"
 
22
 
 
23
#include <konq_historymgr.h>
 
24
#include <kaction.h>
 
25
#include <qptrlist.h>
 
26
 
 
27
class HistoryEntry;
 
28
class QPopupMenu;
 
29
 
 
30
/**
 
31
 * Plug this action into a menu to get a bidirectional history
 
32
 * (both back and forward, including current location)
 
33
 */
 
34
class KonqBidiHistoryAction : public KAction
 
35
{
 
36
  Q_OBJECT
 
37
public:
 
38
    KonqBidiHistoryAction( const QString & text, QObject* parent = 0, const char* name = 0 );
 
39
 
 
40
    virtual ~KonqBidiHistoryAction() {};
 
41
 
 
42
    virtual int plug( QWidget *widget, int index = -1 );
 
43
    //virtual void unplug( QWidget *widget );
 
44
 
 
45
    void fillGoMenu( const QPtrList<HistoryEntry> &history );
 
46
 
 
47
    // Used by KonqHistoryAction and KonqBidiHistoryAction
 
48
    static void fillHistoryPopup( const QPtrList<HistoryEntry> &history,
 
49
                           QPopupMenu * popup,
 
50
                           bool onlyBack = false,
 
51
                           bool onlyForward = false,
 
52
                           bool checkCurrentItem = false,
 
53
                           uint startPos = 0 );
 
54
 
 
55
protected slots:
 
56
    void slotActivated( int );
 
57
 
 
58
signals:
 
59
    void menuAboutToShow();
 
60
    // -1 for one step back, 0 for don't move, +1 for one step forward, etc.
 
61
    void activated( int );
 
62
private:
 
63
    uint m_firstIndex; // first index in the Go menu
 
64
    int m_startPos;
 
65
    int m_currentPos; // == history.at()
 
66
    QPopupMenu *m_goMenu; // hack
 
67
};
 
68
 
 
69
/////
 
70
 
 
71
class KonqLogoAction : public KAction
 
72
{
 
73
  Q_OBJECT
 
74
public:
 
75
    KonqLogoAction( const QString& text, int accel = 0, QObject* parent = 0, const char* name = 0 );
 
76
    KonqLogoAction( const QString& text, int accel,
 
77
                    QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
 
78
    KonqLogoAction( const QString& text, const QIconSet& pix, int accel = 0,
 
79
                    QObject* parent = 0, const char* name = 0 );
 
80
    KonqLogoAction( const QString& text, const QIconSet& pix, int accel,
 
81
                    QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
 
82
    // text missing !
 
83
    KonqLogoAction( const QStringList& icons, QObject* receiver,
 
84
                    const char* slot, QObject* parent, const char* name = 0 );
 
85
 
 
86
    virtual int plug( QWidget *widget, int index = -1 );
 
87
    virtual void updateIcon(int id);
 
88
 
 
89
    void start();
 
90
    void stop();
 
91
 
 
92
private:
 
93
    QStringList iconList;
 
94
};
 
95
 
 
96
class KonqViewModeAction : public KRadioAction
 
97
{
 
98
    Q_OBJECT
 
99
public:
 
100
    KonqViewModeAction( const QString &text, const QString &icon,
 
101
                        QObject *parent, const char *name );
 
102
    virtual ~KonqViewModeAction();
 
103
 
 
104
    virtual int plug( QWidget *widget, int index = -1 );
 
105
 
 
106
    QPopupMenu *popupMenu() const { return m_menu; }
 
107
 
 
108
private slots:
 
109
    void slotPopupAboutToShow();
 
110
    void slotPopupActivated();
 
111
    void slotPopupAboutToHide();
 
112
 
 
113
private:
 
114
    bool m_popupActivated;
 
115
    QPopupMenu *m_menu;
 
116
};
 
117
 
 
118
class MostOftenList : public KonqBaseHistoryList
 
119
{
 
120
protected:
 
121
    /**
 
122
     * Ensures that the items are sorted by numberOfTimesVisited
 
123
     */
 
124
    virtual int compareItems( QPtrCollection::Item, QPtrCollection::Item );
 
125
};
 
126
 
 
127
class KonqMostOftenURLSAction : public KActionMenu
 
128
{
 
129
    Q_OBJECT
 
130
 
 
131
public:
 
132
    KonqMostOftenURLSAction( const QString& text, QObject *parent,
 
133
                             const char *name );
 
134
    virtual ~KonqMostOftenURLSAction();
 
135
 
 
136
signals:
 
137
    void activated( const KURL& );
 
138
 
 
139
private slots:
 
140
    void slotHistoryCleared();
 
141
    void slotEntryAdded( const KonqHistoryEntry *entry );
 
142
    void slotEntryRemoved( const KonqHistoryEntry *entry );
 
143
 
 
144
    void slotFillMenu();
 
145
    //void slotClearMenu();
 
146
 
 
147
    void slotActivated( int );
 
148
 
 
149
private:
 
150
    void init();
 
151
    void parseHistory();
 
152
 
 
153
    static MostOftenList *s_mostEntries;
 
154
    static uint s_maxEntries;
 
155
    KURL::List m_popupList;
 
156
};
 
157
 
 
158
class KonqGoURLAction : public KAction
 
159
{
 
160
public:
 
161
    KonqGoURLAction( const QString &text, const QString &pix, int accel,
 
162
                     const QObject *receiver, const char *slot,
 
163
                     QObject *parent, const char *name );
 
164
 
 
165
    virtual int plug( QWidget *widget, int index = -1 );
 
166
};
 
167
 
 
168
#endif