~ubuntu-branches/ubuntu/edgy/gwenview/edgy

« back to all changes in this revision

Viewing changes to src/app/dirview.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-12-06 17:59:19 UTC
  • mfrom: (1.1.3 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20051206175919-8yv9nfmw0pws6p52
Tags: 1.3.1-0ubuntu1
* Sync with Debian
* Edit kde.mk for .pot generation

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// vim: set tabstop=4 shiftwidth=4 noexpandtab
 
2
/*
 
3
Gwenview - A simple image viewer for KDE
 
4
Copyright 2000-2004 Aur�lien G�teau
 
5
 
 
6
This program is free software; you can redistribute it and/or
 
7
modify it under the terms of the GNU General Public License
 
8
as published by the Free Software Foundation; either version 2
 
9
of the License, or (at your option) any later version.
 
10
 
 
11
This program is distributed in the hope that it will be useful,
 
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
GNU General Public License for more details.
 
15
 
 
16
You should have received a copy of the GNU General Public License
 
17
along with this program; if not, write to the Free Software
 
18
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
19
 
 
20
*/
 
21
#ifndef DIRVIEW_H
 
22
#define DIRVIEW_H
 
23
 
 
24
// Qt
 
25
#include <qptrlist.h>
 
26
 
 
27
// KDE
 
28
#include <kfiletreebranch.h>
 
29
#include <kfiletreeview.h>
 
30
 
 
31
class QPopupMenu;
 
32
class QShowEvent;
 
33
class KURL;
 
34
 
 
35
namespace Gwenview {
 
36
class FileTreeBranch : public KFileTreeBranch {
 
37
public:
 
38
        FileTreeBranch(KFileTreeView* tv, const KURL& url, const QString& title, const QString& icon);
 
39
        ~FileTreeBranch() {}
 
40
 
 
41
        const QString& icon() const { return mIcon; }
 
42
private:
 
43
        QString mIcon;
 
44
};
 
45
 
 
46
class DirView : public KFileTreeView {
 
47
Q_OBJECT
 
48
public:
 
49
        DirView(QWidget* parent);
 
50
 
 
51
        void readConfig(KConfig* config, const QString& group);
 
52
        void writeConfig(KConfig* config, const QString& group);
 
53
 
 
54
public slots:
 
55
        void setURL(const KURL&);
 
56
        
 
57
signals:
 
58
        void dirURLChanged(const KURL&);
 
59
        void dirRenamed(const KURL& oldURL, const KURL& newURL);
 
60
 
 
61
protected:
 
62
        void showEvent(QShowEvent*);
 
63
        
 
64
// Drag'n'drop
 
65
        void contentsDragMoveEvent(QDragMoveEvent* event);
 
66
        void contentsDragLeaveEvent(QDragLeaveEvent* event);
 
67
        void contentsDropEvent(QDropEvent*);
 
68
 
 
69
protected slots:
 
70
        void slotNewTreeViewItems(KFileTreeBranch*,const KFileTreeViewItemList&); 
 
71
        
 
72
private slots:
 
73
        void slotExecuted();
 
74
        void slotItemsRefreshed(const KFileItemList& items);
 
75
 
 
76
        // Do not name this slot "slotPopulateFinished", it will clash with
 
77
        // "KFileTreeView::slotPopulateFinished".
 
78
        void slotDirViewPopulateFinished(KFileTreeViewItem*);
 
79
 
 
80
// Drag'n'Drop
 
81
        void autoOpenDropTarget();
 
82
 
 
83
// Popup menu
 
84
        void slotContextMenu(KListView*,QListViewItem*,const QPoint&);
 
85
        void makeDir();
 
86
        void renameDir();
 
87
        void removeDir();
 
88
        void showPropertiesDialog();
 
89
        void makeBranch();
 
90
        void removeBranch();
 
91
        void showBranchPropertiesDialog();
 
92
 
 
93
        void slotDirMade(KIO::Job*);
 
94
        void slotDirRenamed(KIO::Job*);
 
95
        void slotDirRemoved(KIO::Job*);
 
96
 
 
97
private:
 
98
        KFileTreeViewItem* findViewItem(KFileTreeViewItem*,const QString&);
 
99
        void addBranch(const QString& url, const QString& title, const QString& icon);
 
100
        void defaultBranches();
 
101
        void showBranchPropertiesDialog(FileTreeBranch* editItem);
 
102
        QPopupMenu* mPopupMenu;
 
103
        QPopupMenu* mBranchPopupMenu;
 
104
        int mBranchNewFolderItem;
 
105
        QTimer* mAutoOpenTimer;
 
106
        KFileTreeViewItem* mDropTarget;
 
107
        QPtrList<FileTreeBranch> mBranches;
 
108
 
 
109
        /**
 
110
         * Really defines the url, does not check if the wanted url is already the
 
111
         * current one
 
112
         */
 
113
        void setURLInternal(const KURL&);
 
114
        void refreshBranch(KFileItem* item, KFileTreeBranch* branch);
 
115
};
 
116
 
 
117
 
 
118
} // namespace
 
119
#endif
 
120