[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/sysadmin/muon/src
From: Jonathan Michael Thomas <echidnaman () kubuntu ! org>
Date: 2010-06-30 19:10:09
Message-ID: 20100630191009.81DCFAC8E1 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1144767 by jmthomas:
Change the package when the selection is changed, not only when a package is clicked. \
This means that the selected package and the details tab are always in sync. Also fix \
a crash that sprung up because of that change
M +4 -1 ManagerWidget.cpp
M +8 -0 PackageModel/PackageView.cpp
M +6 -0 PackageModel/PackageView.h
M +9 -2 ReviewWidget.cpp
--- trunk/playground/sysadmin/muon/src/ManagerWidget.cpp #1144766:1144767
@@ -72,7 +72,7 @@
m_packageView = new PackageView(topVBox);
m_packageView->setModel(m_proxyModel);
m_packageView->setItemDelegate(delegate);
- connect (m_packageView, SIGNAL(activated(const QModelIndex&)),
+ connect (m_packageView, SIGNAL(currentPackageChanged(const QModelIndex&)),
this, SLOT(packageActivated(const QModelIndex&)));
KVBox *bottomVBox = new KVBox;
@@ -126,6 +126,9 @@
void ManagerWidget::packageActivated(const QModelIndex &index)
{
+ if (!index.isValid()) {
+ return;
+ }
QApt::Package *package = m_proxyModel->packageAt(index);
m_detailsWidget->setPackage(package);
}
--- trunk/playground/sysadmin/muon/src/PackageModel/PackageView.cpp #1144766:1144767
@@ -22,6 +22,8 @@
#include <QtGui/QHeaderView>
+#include <KDebug>
+
PackageView::PackageView(QWidget *parent)
: QTreeView(parent)
{
@@ -35,6 +37,12 @@
{
}
+void PackageView::currentChanged(const QModelIndex & current, const QModelIndex & \
previous) +{
+ emit currentPackageChanged(current);
+ QAbstractItemView::currentChanged(current, previous);
+}
+
void PackageView::updateView()
{
QModelIndex oldIndex = currentIndex();
--- trunk/playground/sysadmin/muon/src/PackageModel/PackageView.h #1144766:1144767
@@ -30,8 +30,14 @@
explicit PackageView(QWidget *parent);
~PackageView();
+protected Q_SLOTS:
+ void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
+
public Q_SLOTS:
void updateView();
+
+signals:
+ void currentPackageChanged(const QModelIndex ¤t);
};
#endif
--- trunk/playground/sysadmin/muon/src/ReviewWidget.cpp #1144766:1144767
@@ -61,7 +61,7 @@
m_packageView = new PackageView(topVBox);
m_packageView->setModel(m_proxyModel);
m_packageView->setItemDelegate(delegate);
- connect (m_packageView, SIGNAL(activated(const QModelIndex&)),
+ connect (m_packageView, SIGNAL(currentPackageChanged(const QModelIndex&)),
this, SLOT(packageActivated(const QModelIndex&)));
KVBox *bottomVBox = new KVBox;
@@ -97,14 +97,21 @@
void ReviewWidget::refresh()
{
+ m_detailsWidget->clear();
m_model->clear();
+ m_proxyModel->clear();
+ m_proxyModel->setSourceModel(0);
m_model->setPackages(m_backend->markedPackages());
- m_detailsWidget->clear();
+ m_proxyModel->setSourceModel(m_model);
+ m_packageView->header()->setResizeMode(0, QHeaderView::Stretch);
m_packageView->updateView();
}
void ReviewWidget::packageActivated(const QModelIndex &index)
{
+ if (!index.isValid()) {
+ return;
+ }
QApt::Package *package = m_proxyModel->packageAt(index);
m_detailsWidget->setPackage(package);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic