From 877648a7f8bd32da6e17b47400972e4d834dddad Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 14 Apr 2015 11:34:37 -0400 Subject: Add the ability for lumina-open to be able to offer recommendations on web browsers and email applications if no default is set. It does this by scanning all the applications within the "network" and "utility" categories, and adds it to the recommendations if the app takes URL's as inputs. --- lumina-open/LFileDialog.cpp | 15 +++++++++++---- lumina-open/LFileDialog.h | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'lumina-open') diff --git a/lumina-open/LFileDialog.cpp b/lumina-open/LFileDialog.cpp index 361cd99f..4010dc74 100644 --- a/lumina-open/LFileDialog.cpp +++ b/lumina-open/LFileDialog.cpp @@ -34,12 +34,13 @@ LFileDialog::~LFileDialog(){ void LFileDialog::setFileInfo(QString filename, QString extension, bool isFile){ //Set the labels for the file ui->label_file->setText( this->fontMetrics().elidedText( filename, Qt::ElideMiddle, 300 ) ); + bool shownetwork = false; if(isFile){ ui->label_extension->setText( "("+extension+")"); } - else if(extension=="email"){ ui->label_extension->setText( QString(tr("(Email Link)")) ); } - else if(extension=="webbrowser"){ ui->label_extension->setText( QString(tr("(Internet URL)")) ); } + else if(extension=="email"){ ui->label_extension->setText( QString(tr("(Email Link)")) ); shownetwork = true; } + else if(extension=="webbrowser"){ ui->label_extension->setText( QString(tr("(Internet URL)")) ); shownetwork = true; } else{ui->label_extension->setText("("+extension+" link)"); } fileEXT = extension; //NOTE: this is the mime-type for the file now, not the extension - generateAppList(); + generateAppList(shownetwork); } //static functions @@ -160,7 +161,7 @@ void LFileDialog::updateUI(){ ui->tool_ok->setEnabled(good); } -void LFileDialog::generateAppList(){ +void LFileDialog::generateAppList(bool shownetwork){ //Now load the preferred applications PREFAPPS = getPreferredApplications(); ui->combo_rec->clear(); @@ -175,6 +176,12 @@ void LFileDialog::generateAppList(){ QList app = hash[cat[c]]; QTreeWidgetItem *ci = new QTreeWidgetItem(ui->tree_apps, QStringList() << translateCat(cat[c])); for(int a=0; asetWhatsThis(0, app[a].filePath); ti->setIcon(0, LXDG::findIcon(app[a].icon, "application-x-desktop")); diff --git a/lumina-open/LFileDialog.h b/lumina-open/LFileDialog.h index eaed3625..96016cf2 100644 --- a/lumina-open/LFileDialog.h +++ b/lumina-open/LFileDialog.h @@ -61,7 +61,7 @@ private: private slots: void updateUI(); - void generateAppList(); + void generateAppList(bool shownetwork = false); //Internal UI slots void radioChanged(); //void on_group_binary_toggled(bool checked); -- cgit