summaryrefslogtreecommitdiffstats
path: root/src/directorylist.h
diff options
context:
space:
mode:
authorMavridis Philippe <[email protected]>2021-01-13 19:26:24 +0200
committerMavridis Philippe <[email protected]>2021-01-13 19:26:24 +0200
commit8c20dc919f7d54eb48fb60f39ba5e1d466a70763 (patch)
tree44d89f278d5dd066603e5ab9c0b270bc8eb4ad51 /src/directorylist.h
downloadklamav-8c20dc919f7d54eb48fb60f39ba5e1d466a70763.tar.gz
klamav-8c20dc919f7d54eb48fb60f39ba5e1d466a70763.zip
Initial commit
Signed-off-by: Mavridis Philippe <[email protected]>
Diffstat (limited to 'src/directorylist.h')
-rw-r--r--src/directorylist.h124
1 files changed, 124 insertions, 0 deletions
diff --git a/src/directorylist.h b/src/directorylist.h
new file mode 100644
index 0000000..6be1b59
--- /dev/null
+++ b/src/directorylist.h
@@ -0,0 +1,124 @@
+/***************************************************************************
+ directorylist.h
+ -------------------
+ begin : Tue Feb 4 2003
+ copyright : (C) 2003 Scott Wheeler <[email protected]>
+ : (C) 2004 Max Howell <[email protected]>
+ : (C) 2004 Mark Kretschmann <[email protected]>
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program 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; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _DIRECTORYLIST_H
+#define _DIRECTORYLIST_H
+
+#include <qcheckbox.h> //inlined functions
+#include <qlistview.h> //baseclass
+#include <qvbox.h> //baseclass
+
+#include <kdirlister.h> //stack allocated
+#include <kurl.h> //stack allocated
+
+
+namespace Collection { class Item; }
+
+
+class CollectionSetup : public QVBox
+{
+Q_OBJECT
+ friend class Collection::Item;
+
+public:
+ static CollectionSetup* instance() { return s_instance; }
+
+ CollectionSetup( QWidget* ,bool );
+
+ QStringList dirs() const { return m_dirs; }
+ bool recursive() const { return m_recursive; }
+// bool monitor() const { return m_monitor->isChecked(); }
+// bool importPlaylists() const { return m_playlists->isChecked(); }
+ QStringList m_dirs;
+ QMap<QString,int> m_refcount;
+
+signals:
+ void dirsSelected(QStringList& dirs);
+
+public slots:
+
+ void slotRecursiveToggled(bool on);
+
+private:
+ static CollectionSetup* s_instance;
+
+ QListView *m_view;
+ bool m_recursive;
+ QCheckBox *m_monitor;
+ QCheckBox *m_playlists;
+};
+
+
+namespace Collection { //just to keep it out of the global namespace
+
+class Item : public QObject, public QCheckListItem
+{
+Q_OBJECT
+public:
+ Item( QListView *parent, const QString &name, const QString &path, const QString &icon=QString::null );
+ Item( QListViewItem *parent, const KURL &url );
+
+ QCheckListItem *parent() const { return (QCheckListItem*)QListViewItem::parent(); }
+ bool isDisabled() const { return CollectionSetup::instance()->recursive() && parent() && parent()->isOn(); }
+ QString fullPath() const;
+
+ void setOpen( bool b ); // reimpl.
+ void stateChange( bool ); // reimpl.
+ void activate(); // reimpl.
+ void paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align ); // reimpl.
+
+public slots:
+ void newItems( const KFileItemList& );
+ void completed() { if( childCount() == 0 ) { setExpandable( false ); repaint(); } }
+
+private:
+ KDirLister m_lister;
+ KURL m_url;
+ bool m_listed;
+};
+
+
+class DeviceItem : public QObject, public QCheckListItem
+{
+ Q_OBJECT
+ public:
+ DeviceItem( QListView *parent );
+ DeviceItem( QListViewItem *parent, const QString &name, const KURL &url );
+
+ QCheckListItem *parent() const { return (QCheckListItem*)QListViewItem::parent(); }
+ bool isDisabled() const { return CollectionSetup::instance()->recursive() && parent() && parent()->isOn(); }
+ QString fullPath() const;
+
+ void setOpen( bool b ); // reimpl.
+ void stateChange( bool ); // reimpl.
+ void activate(); // reimpl.
+ void paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align ); // reimpl.
+ public slots:
+ void newItems( const KFileItemList& );
+ void completed() { if( childCount() == 0 ) { setExpandable( false ); repaint(); } }
+ private:
+ void mountDevice(const QString & device);
+ KDirLister m_lister;
+ KURL m_url;
+ bool m_listed;
+};
+} //namespace
+
+
+
+#endif