#include "unfiledNotes.h" #include "ui_unfiledNotes.h" UnfiledNotes::UnfiledNotes(QList appLaunchers, QWidget *parent) : QDialog(parent), ui(new Ui::UnfiledNotes) { ui->setupUi(this); setApplicationLauncher(appLaunchers); init(); } UnfiledNotes::~UnfiledNotes() { delete ui; } void UnfiledNotes::init() { QStringList extensionItems; QStringList extensions; int appLauncher_idx = 0; for(appLauncher_idx = 0; appLauncher_idx < applicationLaunchers.size(); appLauncher_idx++) { int extensions_idx = 0; for(extensions_idx = 0; extensions_idx < applicationLaunchers.at(appLauncher_idx)->getApplicationExtensions().size(); extensions_idx++) { extensions.append(applicationLaunchers.at(appLauncher_idx)->getSingleApplicationExtension(extensions_idx)); extensionItems.append(applicationLaunchers.at(appLauncher_idx)->getApplicationName() + " (" + applicationLaunchers.at(appLauncher_idx)->getSingleApplicationExtension(extensions_idx) + ")"); } } setExtensionList(extensions); ui->fileExtensionBox->addItems(extensionItems); } void UnfiledNotes::on_buttonBox_accepted() { if(ui->fileExtensionBox->currentText() != "") { int idx = 0; for(idx = 0; idx < getExtensionList().size(); idx++) { if(idx == ui->fileExtensionBox->currentIndex()) { QString extension = extensionList.at(idx); setExtension(idx); } } } accept(); } void UnfiledNotes::on_buttonBox_rejected() { reject(); } void UnfiledNotes::setApplicationLauncher(QList appLaunchers) { applicationLaunchers = appLaunchers; } void UnfiledNotes::setExtensionList(QStringList newExtensionList) { extensionList = newExtensionList; } void UnfiledNotes::setExtension(int idx) { extension = extensionList.at(idx); } ApplicationLaunchers* UnfiledNotes::getApplicationLauncherAt(int idx) { return applicationLaunchers.at(idx); } QStringList UnfiledNotes::getExtensionList() { return extensionList; } QString UnfiledNotes::getExtension() { return extension; }