-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 19 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.h | 10 |
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 @@ -64,5 +64,7 @@ namespace Ui { namespace Internal { -OFileViewInterface::OFileViewInterface( OFileSelector* selector ) - : m_selector( selector ) -{} +OFileViewInterface::OFileViewInterface( OFileSelector* _selector ) + : m_selector( _selector ) +{ + selector()->registerView( this ); +} @@ -513,3 +515,3 @@ OFileSelector* OFileViewFileListView::selector() -bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) +bool OFileViewFileListView::eventFilter (QObject *, QEvent *e) { @@ -949,3 +951,3 @@ void OFileSelector::initUI() -bool OFileSelector::eventFilter (QObject *o, QEvent *e) +bool OFileSelector::eventFilter (QObject *, QEvent *e) { @@ -1000,2 +1002,7 @@ void OFileSelector::initViews() +void OFileSelector::registerView( const Internal::OFileViewInterface* iface ) { + m_viewsPtr.append( iface ); +} + + /** @@ -1005,2 +1012,4 @@ OFileSelector::~OFileSelector() { + m_viewsPtr.setAutoDelete( true ); + m_viewsPtr.clear(); } 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 @@ -46,2 +46,3 @@ #include <qstringlist.h> +#include <qlist.h> @@ -185,2 +186,9 @@ private: + + /* + * register a view for deletion. + * This happens on creation of a OFileViewInterface + */ + void registerView( const Internal::OFileViewInterface* ); + private: @@ -196,2 +204,4 @@ private: QMap<QString, Internal::OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr + /* views register themselves automatically */ + QList<Internal::OFileViewInterface> m_viewsPtr; QHBox* m_nameBox; // the LineEdit + Label is hold here |