summaryrefslogtreecommitdiff
path: root/libopie2/opieui
Unidiff
Diffstat (limited to 'libopie2/opieui') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofileselector.cpp19
-rw-r--r--libopie2/opieui/fileselector/ofileselector.h10
2 files changed, 24 insertions, 5 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp
index 5528aed..b06defd 100644
--- a/libopie2/opieui/fileselector/ofileselector.cpp
+++ b/libopie2/opieui/fileselector/ofileselector.cpp
@@ -62,9 +62,11 @@ using namespace Opie::Ui::Internal;
62namespace Opie { 62namespace Opie {
63namespace Ui { 63namespace Ui {
64namespace Internal { 64namespace Internal {
65OFileViewInterface::OFileViewInterface( OFileSelector* selector ) 65OFileViewInterface::OFileViewInterface( OFileSelector* _selector )
66 : m_selector( selector ) 66 : m_selector( _selector )
67{} 67{
68 selector()->registerView( this );
69}
68 70
69OFileViewInterface::~OFileViewInterface() 71OFileViewInterface::~OFileViewInterface()
70{} 72{}
@@ -511,7 +513,7 @@ OFileSelector* OFileViewFileListView::selector()
511 return m_sel; 513 return m_sel;
512} 514}
513 515
514bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) 516bool OFileViewFileListView::eventFilter (QObject *, QEvent *e)
515{ 517{
516 if ( e->type() == QEvent::KeyPress ) 518 if ( e->type() == QEvent::KeyPress )
517 { 519 {
@@ -947,7 +949,7 @@ void OFileSelector::initUI()
947 * This will make sure that the return key in the name edit causes dialogs to close 949 * This will make sure that the return key in the name edit causes dialogs to close
948 */ 950 */
949 951
950bool OFileSelector::eventFilter (QObject *o, QEvent *e) 952bool OFileSelector::eventFilter (QObject *, QEvent *e)
951{ 953{
952 if ( e->type() == QEvent::KeyPress ) 954 if ( e->type() == QEvent::KeyPress )
953 { 955 {
@@ -998,11 +1000,18 @@ void OFileSelector::initViews()
998 m_views.insert( QObject::tr("All Files"), in ); 1000 m_views.insert( QObject::tr("All Files"), in );
999} 1001}
1000 1002
1003void OFileSelector::registerView( const Internal::OFileViewInterface* iface ) {
1004 m_viewsPtr.append( iface );
1005}
1006
1007
1001/** 1008/**
1002 * d'tor 1009 * d'tor
1003 */ 1010 */
1004OFileSelector::~OFileSelector() 1011OFileSelector::~OFileSelector()
1005{ 1012{
1013 m_viewsPtr.setAutoDelete( true );
1014 m_viewsPtr.clear();
1006} 1015}
1007 1016
1008 1017
diff --git a/libopie2/opieui/fileselector/ofileselector.h b/libopie2/opieui/fileselector/ofileselector.h
index 8bcd9ee..de2b98a 100644
--- a/libopie2/opieui/fileselector/ofileselector.h
+++ b/libopie2/opieui/fileselector/ofileselector.h
@@ -44,6 +44,7 @@
44#include <qmap.h> 44#include <qmap.h>
45#include <qvaluelist.h> 45#include <qvaluelist.h>
46#include <qstringlist.h> 46#include <qstringlist.h>
47#include <qlist.h>
47 48
48class QLineEdit; 49class QLineEdit;
49class QComboBox; 50class QComboBox;
@@ -183,6 +184,13 @@ private:
183 /* init the Views :) */ 184 /* init the Views :) */
184 void initViews(); 185 void initViews();
185 186
187
188 /*
189 * register a view for deletion.
190 * This happens on creation of a OFileViewInterface
191 */
192 void registerView( const Internal::OFileViewInterface* );
193
186private: 194private:
187 QLineEdit* m_lneEdit; // the LineEdit for the Name 195 QLineEdit* m_lneEdit; // the LineEdit for the Name
188 QComboBox *m_cmbView, *m_cmbMime; // two ComboBoxes to select the View and MimeType 196 QComboBox *m_cmbView, *m_cmbMime; // two ComboBoxes to select the View and MimeType
@@ -194,6 +202,8 @@ private:
194 MimeTypes m_mimeType; // list of mimetypes 202 MimeTypes m_mimeType; // list of mimetypes
195 203
196 QMap<QString, Internal::OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr 204 QMap<QString, Internal::OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr
205 /* views register themselves automatically */
206 QList<Internal::OFileViewInterface> m_viewsPtr;
197 QHBox* m_nameBox; // the LineEdit + Label is hold here 207 QHBox* m_nameBox; // the LineEdit + Label is hold here
198 QHBox* m_cmbBox; // this holds the two combo boxes 208 QHBox* m_cmbBox; // this holds the two combo boxes
199 209