Skip to content

Commit

Permalink
Added checks and a warning+default location on desktoP
Browse files Browse the repository at this point in the history
  • Loading branch information
alexban01 committed Jun 7, 2022
1 parent a5e6618 commit 70a1afa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ MainWindow::MainWindow(QWidget *parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
user = getenv("USER");
}

MainWindow::~MainWindow()
Expand Down Expand Up @@ -47,6 +46,12 @@ void MainWindow::on_selectDestination_clicked()

void MainWindow::on_generateEntry_clicked()
{
if (executable == NULL)
{
QMessageBox::information(this,"..", "You need to select an executable!");
return;
}

QString locationAndName = destination + "/" + programName + ".desktop";
std::ofstream shortcut;
shortcut.open(locationAndName.toStdString());
Expand Down
6 changes: 3 additions & 3 deletions mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class MainWindow : public QMainWindow
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
QString user = "";
QString user = getenv("USER");
QString executable = "";
QString icon = "";
QString programName = "";
QString destination = "";
QString programName = "Program";
QString destination = "/home/" + user + "/Desktop";

private slots:
void on_selectExecutable_clicked();
Expand Down

0 comments on commit 70a1afa

Please sign in to comment.