From 331b3e22a19b3ec85103f075e4f00d82f88f6558 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 11 May 2016 08:57:34 -0400 Subject: Fix a desktop crash which only seems to happen if you have an existing, but invalid application listed in the users favorites when the start button is clicked. --- .../panel-plugins/systemstart/StartMenu.cpp | 31 ++++++++++++++++------ 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp') diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp index 9f172096..1d22632a 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp @@ -101,8 +101,8 @@ void StartMenu::UpdateAll(){ ui->stackedWidget->setCurrentWidget(ui->page_main); //need to ensure the settings page is not active ui->combo_locale->clear(); QString curr = LUtils::currentLocale(); - qDebug() << "Update Locales:" << locales; - qDebug() << "Current Locale:" << curr; + //qDebug() << "Update Locales:" << locales; + //qDebug() << "Current Locale:" << curr; for(int i=0; icombo_locale->addItem(loc.nativeLanguageName() +" ("+locales[i]+")", locales[i]); //Make the display text prettier later @@ -121,14 +121,18 @@ void StartMenu::UpdateAll(){ } void StartMenu::UpdateMenu(bool forceall){ + //qDebug() << "Update Menu" << forceall; if(forceall){ UpdateAll(); } //Quick update routine before the menu is made visible + //qDebug() << "update favs"; UpdateFavs(); + //qDebug() << "check page"; if(ui->stackedWidget->currentWidget() != ui->page_main){ ui->stackedWidget->setCurrentWidget(ui->page_main); //just show the main page }else{ on_stackedWidget_currentChanged(0); //refresh/update the main page every time } + //qDebug() << "done"; } void StartMenu::ReLoadQuickLaunch(){ @@ -312,6 +316,7 @@ void StartMenu::UpdateFavs(){ else{ tmp = rest; } //everything left over if(type==1){ //Need to run a special routine for sorting the apps (already in the widget) + //qDebug() << "Sort App Widgets..."; // Since each app actually might have a different name listed within the file QLayout *lay = ui->scroll_favs->widget()->layout(); QStringList items; @@ -320,7 +325,7 @@ void StartMenu::UpdateFavs(){ } items.sort(); - //qDebug() << " - Sorted Items:" << items; + // qDebug() << " - Sorted Items:" << items; for(int i=0; iscroll_favs->widget(), tmp[i].section("::::",2,50), tmp[i].section("::::",1,1) ); - if(!it->gooditem){ continue; } //invalid for some reason + if( !QFile::exists(tmp[i].section("::::",2,-1)) ){ continue; } //invalid favorite - skip it + ItemWidget *it = 0; + if( tmp[i].section("::::",2,-1).endsWith(".desktop")){ + bool ok = false; + XDGDesktop item = LXDG::loadDesktopFile(tmp[i].section("::::",2,-1), ok); + if(ok){ ok = LXDG::checkValidity(item); } + if(ok){ it = new ItemWidget(ui->scroll_favs->widget(), item); } + }else{ + it = new ItemWidget(ui->scroll_favs->widget(), tmp[i].section("::::",2,-1), tmp[i].section("::::",1,1) ); + } + if(it==0){ continue; } + if(!it->gooditem){ it->deleteLater(); continue; } //invalid for some reason ui->scroll_favs->widget()->layout()->addWidget(it); connect(it, SIGNAL(NewShortcut()), this, SLOT(UpdateFavs()) ); connect(it, SIGNAL(RemovedShortcut()), this, SLOT(UpdateFavs()) ); connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); connect(it, SIGNAL(toggleQuickLaunch(QString, bool)), this, SLOT(UpdateQuickLaunch(QString, bool)) ); } - QApplication::processEvents(); - } + //QApplication::processEvents(); + } //end loop over types + //qDebug() << "End updateFavs"; } // Page update routines -- cgit