Skip to content

Commit

Permalink
dbpage: show import option when the db is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ikolomiko committed Oct 14, 2024
1 parent 64940c0 commit b58aa12
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
20 changes: 16 additions & 4 deletions src/UI/DatabasePage/databasepage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ namespace UI {

ui->btnAdd->setMenu(menuAdd);

QMenu* menuMore = new QMenu();
menuMore = new QMenu();
QAction* eotyAction = new QAction("Yıl sonu işlemlerini yap");
eotyAction->setIcon(icon);
connect(eotyAction, &QAction::triggered, this, &DatabasePage::actionEoty_clicked);
Expand All @@ -175,6 +175,11 @@ namespace UI {
exportAction->setIcon(icon);
connect(exportAction, &QAction::triggered, this, &DatabasePage::exportUserData);

btnMoreActions[0] = eotyAction;
btnMoreActions[1] = removeClassAction;
btnMoreActions[2] = importAction;
btnMoreActions[3] = exportAction;

menuMore->addAction(eotyAction);
menuMore->addAction(removeClassAction);
menuMore->addAction(importAction);
Expand Down Expand Up @@ -247,8 +252,6 @@ namespace UI {
return;
}



response = QMessageBox::information(this,
"Dışarı Aktar",
"ikoOSKAR uygulama verilerinin bulunduğu yedek dosyası başarıyla oluşturuldu!"
Expand Down Expand Up @@ -335,7 +338,16 @@ namespace UI {

ui->btnDelete->setVisible(!classNames->empty());
ui->btnEdit->setVisible(!classNames->empty());
ui->btnMore->setVisible(!classNames->empty());

menuMore->clear();
if (!classNames->empty()) {
menuMore->addAction(btnMoreActions[0]);
menuMore->addAction(btnMoreActions[1]);
}
menuMore->addAction(btnMoreActions[2]);
if (!classNames->empty()) {
menuMore->addAction(btnMoreActions[3]);
}

// Enable the signal back
connect(tabWidget, &QTabWidget::currentChanged, this, [&]() {
Expand Down
10 changes: 7 additions & 3 deletions src/UI/DatabasePage/databasepage.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "UI/Common/page.h"
#include <QTableWidget>
#include <QWidget>
#include <array>

namespace ikoOSKAR {
namespace UI {
Expand Down Expand Up @@ -43,14 +44,17 @@ namespace UI {
void on_btnEdit_clicked();

private:
Ui::DatabasePage* ui;
ikoOSKAR::BLL::DatabaseHelper* bll;
inline static DatabasePage* instance;
std::array<QAction*, 4> btnMoreActions;
QMenu* menuMore;

void refresh();
void createButtonMenus();
void createTabWidget();
void createStudentContextMenu();
inline QString currentClassname();
Ui::DatabasePage* ui;
ikoOSKAR::BLL::DatabaseHelper* bll;
inline static DatabasePage* instance;
explicit DatabasePage(QWidget* parent = nullptr);
void importUserData();
void exportUserData();
Expand Down

0 comments on commit b58aa12

Please sign in to comment.