summaryrefslogtreecommitdiffstats
path: root/kicker
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-05-08 18:49:16 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-05-08 18:49:16 -0500
commitecc6ff1e72c37905aaecbe7708df08dbd6a21f8f (patch)
tree8933335c56bab0df64d8f9b36701fbe65e345362 /kicker
parent1fbdb78d932e66263f82a1a306b5900cc44b7107 (diff)
downloadtdebase-ecc6ff1e72c37905aaecbe7708df08dbd6a21f8f.tar.gz
tdebase-ecc6ff1e72c37905aaecbe7708df08dbd6a21f8f.zip
Fix Kickoff-style menu hang and incorrect device listing
This resolves Bug 1491
Diffstat (limited to 'kicker')
-rw-r--r--kicker/kicker/ui/k_new_mnu.cpp55
1 files changed, 38 insertions, 17 deletions
diff --git a/kicker/kicker/ui/k_new_mnu.cpp b/kicker/kicker/ui/k_new_mnu.cpp
index f1781d8b5..4e61f8eca 100644
--- a/kicker/kicker/ui/k_new_mnu.cpp
+++ b/kicker/kicker/ui/k_new_mnu.cpp
@@ -3436,8 +3436,9 @@ void KMenu::slotFavoritesMoved( TQListViewItem* item, TQListViewItem* /*afterFir
void KMenu::updateMedia()
{
TQStringList devices = m_mediaWatcher->devices();
- if ( devices.isEmpty() )
+ if ( devices.isEmpty() ) {
return;
+ }
int nId = serviceMenuStartId();
if ( m_media_id ) {
@@ -3457,21 +3458,42 @@ void KMenu::updateMedia()
m_systemView->insertSeparator( nId++, i18n("Media"), -1);
}
+ // WARNING
+ // This loop MUST be kept in sync with the data structure listed in libmediacommon/medium.h
+ #define SAFE_INCREMENT it++; if (it == devices.constEnd()) { printf("[kicker] Warning: incompatible media device list encountered!\n"); break; }
for ( TQStringList::ConstIterator it = devices.constBegin(); it != devices.constEnd(); ++it )
{
- TQString id = ( *it );
- TQString name = *++it;
- TQString label = *++it;
- TQString userLabel = ( *++it );
- bool mountable = ( *++it == "true" ); // bool
- ( void )mountable;
- TQString deviceNode = ( *++it );
- TQString mountPoint = ( *++it );
- TQString fsType = ( *++it );
- bool mounted = ( *++it == "true" ); // bool
- TQString baseURL = ( *++it );
- TQString mimeType = ( *++it );
- TQString iconName = ( *++it );
+ TQString id = *it;
+ SAFE_INCREMENT
+ TQString uuid = *it;
+ SAFE_INCREMENT
+ TQString name = *it;
+ SAFE_INCREMENT
+ TQString label = *it;
+ SAFE_INCREMENT
+ TQString userLabel = *it;
+ SAFE_INCREMENT
+ bool mountable = ( *it == "true" ); // bool
+ SAFE_INCREMENT
+ TQString deviceNode = ( *it );
+ SAFE_INCREMENT
+ TQString mountPoint = ( *it );
+ SAFE_INCREMENT
+ TQString fsType = ( *it );
+ SAFE_INCREMENT
+ bool mounted = ( *it == "true" ); // bool
+ SAFE_INCREMENT
+ TQString baseURL = ( *it );
+ SAFE_INCREMENT
+ TQString mimeType = ( *it );
+ SAFE_INCREMENT
+ TQString iconName = ( *it );
+ SAFE_INCREMENT
+ bool encrypted = ( *it == "true" ); // bool
+ SAFE_INCREMENT
+ TQString clearDeviceUDI = ( *it );
+ SAFE_INCREMENT
+ bool hidden = ( *it == "true" ); // bool
media_mimetypes["system:/media/"+name] = mimeType;
@@ -3498,10 +3520,9 @@ void KMenu::updateMedia()
}
m_systemView->insertItem( iconName, userLabel.isEmpty() ? label : userLabel,
descr, "system:/media/" + name, nId++, -1 );
- ++it;
- ++it;
- ++it; // skip separator
+ SAFE_INCREMENT // skip separator
}
+ #undef SAFE_INCREMENT
}
bool KMenu::ensureServiceRunning(const TQString & service)