summaryrefslogtreecommitdiff
path: root/libopie2
authorzecke <zecke>2004-07-24 13:16:26 (UTC)
committer zecke <zecke>2004-07-24 13:16:26 (UTC)
commit144d91fee9e0ec0cb672508637c639cfbbf4e750 (patch) (unidiff)
tree802d12ac283361e3d5d710a6b8387dc22b88c462 /libopie2
parent1efb57a4cffc8a19a0dadbd008ff205d3d61d216 (diff)
downloadopie-144d91fee9e0ec0cb672508637c639cfbbf4e750.zip
opie-144d91fee9e0ec0cb672508637c639cfbbf4e750.tar.gz
opie-144d91fee9e0ec0cb672508637c639cfbbf4e750.tar.bz2
Delete the Views which are created in the OFileSelector
Add a new member and one method to register the view. The views themselves (baseclass) call this function. Simply going over the viewMap wouldn't work as we can have the same instance contained twice under a different name
Diffstat (limited to 'libopie2') (more/less context) (show 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
@@ -63,7 +63,9 @@ namespace 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()
@@ -512,5 +514,5 @@ OFileSelector* OFileViewFileListView::selector()
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 )
@@ -948,5 +950,5 @@ void OFileSelector::initUI()
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 )
@@ -999,4 +1001,9 @@ void OFileSelector::initViews()
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
@@ -1004,4 +1011,6 @@ void OFileSelector::initViews()
1004OFileSelector::~OFileSelector() 1011OFileSelector::~OFileSelector()
1005{ 1012{
1013 m_viewsPtr.setAutoDelete( true );
1014 m_viewsPtr.clear();
1006} 1015}
1007 1016
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
@@ -45,4 +45,5 @@
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;
@@ -184,4 +185,11 @@ private:
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
@@ -195,4 +203,6 @@ private:
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