Renamed AbsenceDialog to AbsencesDialog
This commit is contained in:
@@ -4,17 +4,20 @@ TARGET = absenceplugin
|
|||||||
|
|
||||||
DBLIBS += core gui
|
DBLIBS += core gui
|
||||||
|
|
||||||
HEADERS += absencedialog.h \
|
HEADERS += \
|
||||||
absencesmodel.h \
|
absencesmodel.h \
|
||||||
absenceplugin.h \
|
absenceplugin.h \
|
||||||
absencewidget.h
|
absencewidget.h \
|
||||||
|
absencesdialog.h
|
||||||
|
|
||||||
SOURCES += absencedialog.cpp \
|
SOURCES += \
|
||||||
absencesmodel.cpp \
|
absencesmodel.cpp \
|
||||||
absenceplugin.cpp \
|
absenceplugin.cpp \
|
||||||
absencewidget.cpp
|
absencewidget.cpp \
|
||||||
|
absencesdialog.cpp
|
||||||
|
|
||||||
FORMS += absencedialog.ui
|
FORMS += \
|
||||||
|
absencesdialog.ui
|
||||||
|
|
||||||
RESOURCES += absenceplugin_resources.qrc
|
RESOURCES += absenceplugin_resources.qrc
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#include "absencedialog.h"
|
#include "absencesdialog.h"
|
||||||
#include "ui_absencedialog.h"
|
#include "ui_absencesdialog.h"
|
||||||
|
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
@@ -10,35 +10,35 @@
|
|||||||
|
|
||||||
#include "absencesmodel.h"
|
#include "absencesmodel.h"
|
||||||
|
|
||||||
AbsenceDialog::AbsenceDialog(int userId, const QDate &date, ZeiterfassungApi &erfassung, QWidget *parent) :
|
AbsencesDialog::AbsencesDialog(int userId, const QDate &date, ZeiterfassungApi &erfassung, QWidget *parent) :
|
||||||
ZeiterfassungDialog(parent),
|
ZeiterfassungDialog(parent),
|
||||||
ui(new Ui::AbsenceDialog)
|
ui(new Ui::AbsencesDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->labelTitle->setText(tr("Absences for %0").arg(QLocale().toString(date)));
|
ui->labelTitle->setText(tr("Absences for %0").arg(QLocale().toString(date)));
|
||||||
|
|
||||||
m_model = new AbsencesModel(userId, date, erfassung, this);
|
m_model = new AbsencesModel(userId, date, erfassung, this);
|
||||||
connect(m_model, &AbsencesModel::errorOccured, this, &AbsenceDialog::errorOccured);
|
connect(m_model, &AbsencesModel::errorOccured, this, &AbsencesDialog::errorOccured);
|
||||||
|
|
||||||
ui->treeView->setModel(m_model);
|
ui->treeView->setModel(m_model);
|
||||||
ui->treeView->setEnabled(m_model->enabled());
|
ui->treeView->setEnabled(m_model->enabled());
|
||||||
connect(m_model, &AbsencesModel::enabledChanged, ui->treeView, &QWidget::setEnabled);
|
connect(m_model, &AbsencesModel::enabledChanged, ui->treeView, &QWidget::setEnabled);
|
||||||
|
|
||||||
connect(ui->treeView, &QWidget::customContextMenuRequested, this, &AbsenceDialog::customContextMenuRequested);
|
connect(ui->treeView, &QWidget::customContextMenuRequested, this, &AbsencesDialog::customContextMenuRequested);
|
||||||
}
|
}
|
||||||
|
|
||||||
AbsenceDialog::~AbsenceDialog()
|
AbsencesDialog::~AbsencesDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbsenceDialog::errorOccured(const QString &message)
|
void AbsencesDialog::errorOccured(const QString &message)
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Could not load absences!"), tr("Could not load absences!") % "\n\n" % message);
|
QMessageBox::warning(this, tr("Could not load absences!"), tr("Could not load absences!") % "\n\n" % message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbsenceDialog::customContextMenuRequested(const QPoint &pos)
|
void AbsencesDialog::customContextMenuRequested(const QPoint &pos)
|
||||||
{
|
{
|
||||||
auto index = ui->treeView->indexAt(pos);
|
auto index = ui->treeView->indexAt(pos);
|
||||||
|
|
@@ -7,22 +7,22 @@ class QDate;
|
|||||||
class ZeiterfassungApi;
|
class ZeiterfassungApi;
|
||||||
|
|
||||||
class AbsencesModel;
|
class AbsencesModel;
|
||||||
namespace Ui { class AbsenceDialog; }
|
namespace Ui { class AbsencesDialog; }
|
||||||
|
|
||||||
class AbsenceDialog : public ZeiterfassungDialog
|
class AbsencesDialog : public ZeiterfassungDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AbsenceDialog(int userId, const QDate &date, ZeiterfassungApi &erfassung, QWidget *parent = 0);
|
explicit AbsencesDialog(int userId, const QDate &date, ZeiterfassungApi &erfassung, QWidget *parent = 0);
|
||||||
~AbsenceDialog();
|
~AbsencesDialog();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void errorOccured(const QString &message);
|
void errorOccured(const QString &message);
|
||||||
void customContextMenuRequested(const QPoint &pos);
|
void customContextMenuRequested(const QPoint &pos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AbsenceDialog *ui;
|
Ui::AbsencesDialog *ui;
|
||||||
|
|
||||||
AbsencesModel *m_model;
|
AbsencesModel *m_model;
|
||||||
};
|
};
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>AbsenceDialog</class>
|
<class>AbsencesDialog</class>
|
||||||
<widget class="QDialog" name="AbsenceDialog">
|
<widget class="QDialog" name="AbsencesDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>accepted()</signal>
|
<signal>accepted()</signal>
|
||||||
<receiver>AbsenceDialog</receiver>
|
<receiver>AbsencesDialog</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>rejected()</signal>
|
||||||
<receiver>AbsenceDialog</receiver>
|
<receiver>AbsencesDialog</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
@@ -3,7 +3,7 @@
|
|||||||
#include "stripswidget.h"
|
#include "stripswidget.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#include "absencedialog.h"
|
#include "absencesdialog.h"
|
||||||
|
|
||||||
AbsenceWidget::AbsenceWidget(StripsWidget &stripsWidget) :
|
AbsenceWidget::AbsenceWidget(StripsWidget &stripsWidget) :
|
||||||
QToolButton(&stripsWidget),
|
QToolButton(&stripsWidget),
|
||||||
@@ -17,7 +17,7 @@ AbsenceWidget::AbsenceWidget(StripsWidget &stripsWidget) :
|
|||||||
|
|
||||||
void AbsenceWidget::pressedSlot()
|
void AbsenceWidget::pressedSlot()
|
||||||
{
|
{
|
||||||
AbsenceDialog dialog(m_stripsWidget.mainWindow().userInfo().userId, m_stripsWidget.date(),
|
AbsencesDialog dialog(m_stripsWidget.mainWindow().userInfo().userId, m_stripsWidget.date(),
|
||||||
m_stripsWidget.mainWindow().erfassung(), this);
|
m_stripsWidget.mainWindow().erfassung(), this);
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user