From 97e8c68d7a92d6ccdb5f6ead8bba0d0af58efb3b Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 27 Oct 2012 13:39:25 +0200 Subject: Bugfixes: don't select dirs and don't crash on write settings Only select files when archiving pics from filemanager. While at it, I noticed a crash on close when no item is selected in PicturesWidget. So check if MappingData is valid on writing settings. Best way is MappingData::isValid(), and for that I needed a explicit constructor. --- mappingtreewidget.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'mappingtreewidget.cpp') diff --git a/mappingtreewidget.cpp b/mappingtreewidget.cpp index e9d0c93..fd3ebe6 100644 --- a/mappingtreewidget.cpp +++ b/mappingtreewidget.cpp @@ -94,13 +94,12 @@ MappingTreeWidget::MappingTreeWidget(QWidget *parent) : QWidget(parent){ } MappingData MappingTreeWidget::selectedItem() const { - MappingData retval = { -1, -1, -1, QString(), QList() }; QModelIndex sel = selected(); if(!sel.isValid()){ - return retval; + return MappingData(); } QModelIndex real = mProxy->mapToSource(sel); - return mModel->mappingDataFromIndex(real); + return mModel->mappingDataFromIndex(real); } void MappingTreeWidget::addChild(){ -- cgit v1.2.3-70-g09d2