//============ // PRIVATE SLOTS //============ void UserWidget::UpdateMenu(){ this->setCurrentWidget(ui->tab_fav); ui->tool_fav_apps->setChecked(true); ui->tool_fav_dirs->setChecked(false); ui->tool_fav_files->setChecked(false); cfav = 0; //favorite apps updateFavItems(); ui->label_home_dir->setWhatsThis(QDir::homePath()); updateHome(); if(lastUpdate < LSession::handle()->applicationMenu()->lastHashUpdate || lastUpdate.isNull()){ updateAppCategories(); updateApps(); } lastUpdate = QDateTime::currentDateTime(); }
//============ // PRIVATE SLOTS //============ void UserWidget::UpdateMenu(){ if(QDateTime::currentDateTime() > lastUpdate.addSecs(30)){ //Only re-arrange/reload things if not rapidly re-run ui->tabWidget->setCurrentWidget(ui->tab_fav); ui->tool_fav_apps->setChecked(true); ui->tool_fav_dirs->setChecked(false); ui->tool_fav_files->setChecked(false); cfav = 0; //favorite apps updateFavItems(); updateHome(); updateAppCategories(); updateApps(); } lastUpdate = QDateTime::currentDateTime(); }
void UserWidget::UpdateMenu(bool forceall){ this->setCurrentWidget(ui->tab_fav); ui->tool_fav_apps->setChecked(true); ui->tool_fav_dirs->setChecked(false); ui->tool_fav_files->setChecked(false); cfav = 0; //favorite apps updateFavItems(); QString cdir = ui->label_home_dir->whatsThis(); if(cdir.isEmpty() || !QFile::exists(cdir)){ //Directory deleted or nothing loaded yet ui->label_home_dir->setWhatsThis(QDir::homePath()); QTimer::singleShot(0,this, SLOT(updateHome()) ); }else if( lastUpdate < QFileInfo(cdir).lastModified() || forceall){ //Directory contents changed - reload it QTimer::singleShot(0,this, SLOT(updateHome()) ); } if(lastUpdate < LSession::handle()->applicationMenu()->lastHashUpdate || lastUpdate.isNull() || forceall){ updateAppCategories(); QTimer::singleShot(0,this, SLOT(updateApps()) ); } lastUpdate = QDateTime::currentDateTime(); }