[Marble-commits] KDE/kdeedu/marble/src/plugins/runner/monav
Dennis Nienhüser
earthwings at gentoo.org
Sun Oct 24 19:36:25 CEST 2010
SVN commit 1189338 by nienhueser:
Request user confirmation before deleting maps. Adjust table column sizes when toggling manage maps mode. Sort level 3 by name, too. Tooltips for upgrade button.
M +19 -2 MonavConfigWidget.cpp
--- trunk/KDE/kdeedu/marble/src/plugins/runner/monav/MonavConfigWidget.cpp #1189337:1189338
@@ -23,6 +23,7 @@
#include <QtGui/QPushButton>
#include <QtGui/QShowEvent>
#include <QtGui/QSortFilterProxyModel>
+#include <QtGui/QMessageBox>
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
#include <QtXml/QDomDocument>
@@ -284,19 +285,27 @@
bool MonavConfigWidgetPrivate::updateRegions( const QString &continent, const QString &state, QComboBox* comboBox )
{
comboBox->clear();
+ QMap<QString,QString> regions;
foreach( const MonavStuffEntry &map, m_remoteMaps ) {
Q_ASSERT( map.isValid() );
if ( map.continent() == continent && map.state() == state ) {
QString item = "%1 - %2";
if ( map.region().isEmpty() ) {
item = item.arg( map.state() );
+ comboBox->addItem( item.arg( map.transport() ), map.payload() );
} else {
- item = item.arg( map.region() );
+ item = item.arg( map.region(), map.transport() );
+ regions.insert( item, map.payload() );
}
- comboBox->addItem( item.arg( map.transport() ), map.payload() );
}
}
+ QMapIterator<QString, QString> iter( regions );
+ while ( iter.hasNext() ) {
+ iter.next();
+ comboBox->addItem( iter.key(), iter.value() );
+ }
+
return true;
}
@@ -578,6 +587,9 @@
m_upgradeMapSignalMapper.setMapping( button, origin.row() );
QObject::connect( button, SIGNAL( clicked() ), &m_upgradeMapSignalMapper, SLOT( map() ) );
bool upgradable = m_mapsModel->data( origin ).toBool();
+ QString canUpgradeText = QObject::tr( "An update is available. Click to install it." );
+ QString isLatestText = QObject::tr( "No update available. You are running the latest version." );
+ button->setToolTip( upgradable ? canUpgradeText : isLatestText );
button->setEnabled( upgradable );
}
{
@@ -607,10 +619,14 @@
void MonavConfigWidget::removeMap( int index )
{
+ QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel;
+ QString text = tr( "Are you sure you want to delete this map from the system?" );
+ if ( QMessageBox::question( this, "Remove Map", text, buttons, QMessageBox::No ) == QMessageBox::Yes ) {
d->m_mapsModel->deleteMapFiles( index );
d->m_plugin->reloadMaps();
d->updateInstalledMapsViewButtons();
}
+}
void MonavConfigWidget::upgradeMap( int index )
{
@@ -633,6 +649,7 @@
m_installedMapsListView->setColumnHidden( 2, !enabled );
m_installedMapsListView->setColumnHidden( 3, !enabled );
m_installedMapsListView->setColumnHidden( 4, !enabled );
+ m_installedMapsListView->resizeColumnsToContents();
}
void MonavConfigWidgetPrivate::setBusy( bool busy, const QString &message ) const
More information about the Marble-commits
mailing list