-rw-r--r-- | noncore/settings/sysinfo/devicesinfo.cpp | 22 | ||||
-rw-r--r-- | noncore/settings/sysinfo/devicesinfo.h | 8 |
2 files changed, 27 insertions, 3 deletions
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp index 4bce65f..f1efb33 100644 --- a/noncore/settings/sysinfo/devicesinfo.cpp +++ b/noncore/settings/sysinfo/devicesinfo.cpp | |||
@@ -75,2 +75,4 @@ void DevicesView::selectionChanged( QListViewItem* item ) | |||
75 | odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl; | 75 | odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl; |
76 | QWidget* details = ( static_cast<Device*>( item ) )->detailsWidget(); | ||
77 | ( static_cast<DevicesInfo*>( parent() ) )->setDetailsWidget( details ); | ||
76 | } | 78 | } |
@@ -80,5 +82,5 @@ void DevicesView::selectionChanged( QListViewItem* item ) | |||
80 | DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl ) | 82 | DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl ) |
81 | :QWidget( parent, name, fl ) | 83 | :QWidget( parent, name, fl ), details( 0 ) |
82 | { | 84 | { |
83 | OAutoBoxLayout *layout = new OAutoBoxLayout( this ); | 85 | layout = new OAutoBoxLayout( this ); |
84 | layout->setSpacing( 4 ); | 86 | layout->setSpacing( 4 ); |
@@ -89,2 +91,3 @@ DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl ) | |||
89 | 91 | ||
92 | |||
90 | DevicesInfo::~DevicesInfo() | 93 | DevicesInfo::~DevicesInfo() |
@@ -94,2 +97,11 @@ DevicesInfo::~DevicesInfo() | |||
94 | 97 | ||
98 | void DevicesInfo::setDetailsWidget( QWidget* w ) | ||
99 | { | ||
100 | if ( details ) delete( details ); | ||
101 | layout->addWidget( w ); | ||
102 | w->show(); | ||
103 | } | ||
104 | |||
105 | |||
106 | //================================================================================================= | ||
95 | Category::Category( DevicesView* parent, const QString& name ) | 107 | Category::Category( DevicesView* parent, const QString& name ) |
@@ -114,2 +126,8 @@ Device::~Device() | |||
114 | 126 | ||
127 | QWidget* Device::detailsWidget() | ||
128 | { | ||
129 | return new QPushButton( static_cast<QWidget*>( listView()->parent() ), "Press Button to self-destruct" ); | ||
130 | } | ||
131 | |||
132 | |||
115 | //================================================================================================= | 133 | //================================================================================================= |
diff --git a/noncore/settings/sysinfo/devicesinfo.h b/noncore/settings/sysinfo/devicesinfo.h index 262af31..b065f40 100644 --- a/noncore/settings/sysinfo/devicesinfo.h +++ b/noncore/settings/sysinfo/devicesinfo.h | |||
@@ -33,2 +33,3 @@ _;:, .> :=|. This program is free software; you can | |||
33 | #include <opie2/olistview.h> | 33 | #include <opie2/olistview.h> |
34 | #include <opie2/olayout.h> | ||
34 | 35 | ||
@@ -56,5 +57,8 @@ public: | |||
56 | 57 | ||
58 | void setDetailsWidget( QWidget* w = 0 ); | ||
59 | |||
57 | private: | 60 | private: |
61 | Opie::Ui::OAutoBoxLayout* layout; | ||
58 | Opie::Ui::OListView* view; | 62 | Opie::Ui::OListView* view; |
59 | 63 | QWidget* details; | |
60 | private slots: | 64 | private slots: |
@@ -78,2 +82,4 @@ public: | |||
78 | ~Device(); | 82 | ~Device(); |
83 | |||
84 | QWidget* detailsWidget(); | ||
79 | }; | 85 | }; |