1 /*************************************************************************** 2 rkfilebrowser - description 3 ------------------- 4 begin : Thu Apr 26 2007 5 copyright : (C) 2007-2018 by Thomas Friedrichsmeier 6 email : thomas.friedrichsmeier@kdemail.net 7 ***************************************************************************/ 8 9 /*************************************************************************** 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 ***************************************************************************/ 17 18 #ifndef RKFILEBROWSER_H 19 #define RKFILEBROWSER_H 20 21 #include "rkmdiwindow.h" 22 23 #include <QList> 24 #include <QUrl> 25 26 class KDirOperator; 27 class RKFileBrowserWidget; 28 class KUrlComboBox; 29 class KFileItem; 30 class KFileItemActions; 31 class QMenu; 32 class QAction; 33 34 /** The file browser (tool) window. In order to save some startup time, the file browser is not really created until it is first shown. Hence, this is mostly just a wrapper around RKFileBrowserWidget */ 35 class RKFileBrowser : public RKMDIWindow { 36 Q_OBJECT 37 public: 38 RKFileBrowser (QWidget *parent, bool tool_window, const char *name=0); 39 ~RKFileBrowser (); 40 41 /** reimplemented to create the real file browser widget only when the file browser is shown for the first time */ 42 void showEvent (QShowEvent *e) override; getMainBrowser()43 static RKFileBrowser *getMainBrowser() { return main_browser; }; 44 private: 45 RKFileBrowserWidget *real_widget; 46 QWidget *layout_widget; 47 friend class RKWardMainWindow; 48 static RKFileBrowser *main_browser; 49 }; 50 51 /** The internal widget used in RKFileBrowser 52 Much of the implementation is a modified copy from Kate / kdevelop. 53 */ 54 class RKFileBrowserWidget : public QWidget { 55 Q_OBJECT 56 public: 57 explicit RKFileBrowserWidget (QWidget *widget); 58 ~RKFileBrowserWidget (); 59 60 bool eventFilter (QObject* o, QEvent* e) override; 61 public slots: 62 void setURL (const QUrl &url); 63 void urlChangedInView (const QUrl &url); 64 void stringChangedInCombo (const QString &url); 65 void urlChangedInCombo (const QUrl &url); 66 void fileActivated (const KFileItem& item); 67 void saveConfig (); 68 void contextMenuHook (const KFileItem &item, QMenu *menu); 69 void rename (); 70 void syncToWD (); 71 private: 72 QList<QAction*> added_service_actions; 73 KDirOperator *dir; 74 KUrlComboBox *urlbox; 75 KFileItemActions *fi_actions; 76 QAction *rename_action; 77 QUrl context_menu_url; 78 bool follow_working_directory; 79 }; 80 81 #endif 82