summaryrefslogtreecommitdiffstats
path: root/konq-plugins/fsview/fsview_part.h
blob: 4f2c734896340f31bce7e5f00f67a13a0343d33a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* This file is part of FSView.
   Copyright (C) 2002, 2003 Josef Weidendorfer <Josef.Weidendorfer@gmx.de>

   KCachegrind is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License as published by the Free Software Foundation, version 2.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

/*
 * The KPart embedding the FSView widget
 */

#ifndef FSVIEW_PART_H
#define FSVIEW_PART_H

#include <kparts/part.h>
#include <kparts/browserextension.h>
#include <kio/jobclasses.h>

#include "fsview.h"

class KAboutData;
class KActionMenu;

class FSViewPart;

class FSViewBrowserExtension : public KParts::BrowserExtension
{
  Q_OBJECT

public:
  FSViewBrowserExtension(FSViewPart *viewPart, const char *name=0L);
  ~FSViewBrowserExtension();

protected slots:
  void selected(TreeMapItem*);
  void contextMenu(TreeMapItem*,const QPoint&);

  void updateActions();
  void refresh();

  void copy() { copySelection( false ); }
  void cut() { copySelection( true ); }
  void trash();
  void del();
  void editMimeType();

private:
  void copySelection( bool move );

  FSView* _view;  
};

class FSJob: public KIO::Job
{
  Q_OBJECT

public:
  FSJob(FSView*);

  virtual void kill( bool quietly = true );

public slots:
  void progressSlot(int percent, int dirs, const QString& lastDir);

private:
  FSView* _view;
};


class FSViewPart : public KParts::ReadOnlyPart
{
  Q_OBJECT
  Q_PROPERTY( bool supportsUndo READ supportsUndo )
public:
  FSViewPart(QWidget *parentWidget, const char *widgetName,
             QObject *parent, const char *name, const QStringList &args);

  virtual ~FSViewPart();

  bool supportsUndo() const { return false; }

  static KAboutData* createAboutData();
  FSView* view() const { return _view; }

public slots:
  void showInfo();
  void showHelp(); 
  void startedSlot();
  void completedSlot(int dirs);
  void slotShowVisMenu();
  void slotShowAreaMenu();
  void slotShowDepthMenu();
  void slotShowColorMenu();
  void slotSettingsChanged(int);

protected:
  /**
   * This must be implemented by each part
   */
  virtual bool openFile();
  virtual bool openURL(const KURL &url);
  virtual bool closeURL();

private:
  FSView* _view;
  FSJob* _job;
  FSViewBrowserExtension* _ext;
  KActionMenu *_visMenu, *_areaMenu, *_depthMenu, *_colorMenu;
};

#endif // FSVIEW_PART_H