From 411ac6f9199b1aae2b6a40e7a8cf6bfea260acba Mon Sep 17 00:00:00 2001 From: zecke Date: Tue, 09 Jul 2002 18:28:19 +0000 Subject: Add a generic class for the sensitive QPopupMenu --- (limited to 'noncore/net/opietooth') diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index c29eb1a..85c6717 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -244,7 +244,7 @@ using namespace OpieTooth; * Add fresh found devices from scan dialog to the listing * */ - void BlueBase::addSearchedDevices( QValueList &newDevices ) { + void BlueBase::addSearchedDevices( const QValueList &newDevices ) { BTListItem * deviceItem; QValueList::ConstIterator it; @@ -434,8 +434,8 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin void BlueBase::startScan() { ScanDialog *scan = new ScanDialog( this, "ScanDialog", true, WDestructiveClose ); - QObject::connect( scan, SIGNAL( selectedDevices( QValueList& ) ), - this, SLOT( addSearchedDevices( QValueList& ) ) ); + QObject::connect( scan, SIGNAL( selectedDevices( const QValueList& ) ), + this, SLOT( addSearchedDevices( const QValueList& ) ) ); scan->showMaximized(); } diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 97ce8c3..73fac97 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h @@ -68,7 +68,7 @@ namespace OpieTooth { BTIconLoader *m_iconLoader; private slots: - void addSearchedDevices( QValueList &newDevices ); + void addSearchedDevices( const QValueList &newDevices ); void addServicesToDevice( BTListItem *item ); void addServicesToDevice( const QString& device, Services::ValueList ); void addConnectedDevices(); diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro index 55f2fd2..4f0ea60 100644 --- a/noncore/net/opietooth/manager/manager.pro +++ b/noncore/net/opietooth/manager/manager.pro @@ -1,8 +1,8 @@ TEMPLATE = app CONFIG = qt warn_on debug #CONFIG = qt warn_on release -HEADERS = bluebase.h scandialog.h btlistitem.h hciconfwrapper.h bticonloader.h -SOURCES = main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp hciconfwrapper.cpp bticonloader.cpp +HEADERS = popuphelper.h bluebase.h scandialog.h btlistitem.h hciconfwrapper.h bticonloader.h +SOURCES = popuphelper.cpp main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp hciconfwrapper.cpp bticonloader.cpp INCLUDEPATH += $(OPIEDIR)/include INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib DEPENDPATH += $(OPIEDIR)/include diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp new file mode 100644 index 0000000..2a6dad0 --- a/dev/null +++ b/noncore/net/opietooth/manager/popuphelper.cpp @@ -0,0 +1,25 @@ + +#include "popuphelper.h" + +using namespace OpieTooth; + +PopupHelper::PopupHelper() { + init(); +} +PopupHelper::~PopupHelper() { + +} +void PopupHelper::insert( int id, popupFactory fact ) { + m_map.insert(id, fact ); +} +QPopupMenu* PopupHelper::find( int id ) { + FactoryMap::Iterator it = m_map.find(id ); + if ( it != m_map.end() ) { + popupFactory fact = it.data(); + return (*fact)(); + } + return 0l; +} +void PopupHelper::init() { + +} diff --git a/noncore/net/opietooth/manager/popuphelper.h b/noncore/net/opietooth/manager/popuphelper.h new file mode 100644 index 0000000..7485f71 --- a/dev/null +++ b/noncore/net/opietooth/manager/popuphelper.h @@ -0,0 +1,25 @@ + +#ifndef OPIE_TOOTH_POPUP_HELPER +#define OPIE_TOOTH_POPUP_HELPER + +#include +#include + + +namespace OpieTooth { + typedef QPopupMenu* (*popupFactory)(void); + typedef QMap FactoryMap; + class PopupHelper { + public: + PopupHelper(); + ~PopupHelper(); + void insert( int id, popupFactory fact ); + QPopupMenu* find( int id ); + private: + void init(); + FactoryMap m_map; + + }; +}; + +#endif diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h index cc890f3..f18784d 100644 --- a/noncore/net/opietooth/manager/scandialog.h +++ b/noncore/net/opietooth/manager/scandialog.h @@ -70,7 +70,7 @@ public slots: int progressStat; signals: - void selectedDevices(QValueList&); + void selectedDevices(const QValueList&); }; -- cgit v0.9.0.2