diff --git a/application/mainwindow.cpp b/application/mainwindow.cpp
index daff678..fdd86ba 100644
--- a/application/mainwindow.cpp
+++ b/application/mainwindow.cpp
@@ -167,3 +167,14 @@ void MainWindow::openPlugin(IPlugin *plugin)
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
}
}
+
+void MainWindow::on_actionCountry_register_triggered()
+{
+ IPlugin *plugCountryReg = Context::instance().plugin("COUNTRYREGISTER");
+
+ if (plugCountryReg != NULL)
+ {
+ openPlugin(plugCountryReg);
+ }
+
+}
diff --git a/application/mainwindow.h b/application/mainwindow.h
index 1f61002..543e84d 100644
--- a/application/mainwindow.h
+++ b/application/mainwindow.h
@@ -37,6 +37,8 @@ private slots:
void on_actionPost_register_triggered();
+ void on_actionCountry_register_triggered();
+
private:
Ui::MainWindow *ui;
LoginDialog *m_loginDialog;
diff --git a/application/mainwindow.ui b/application/mainwindow.ui
index 7b912f7..ce35d2f 100644
--- a/application/mainwindow.ui
+++ b/application/mainwindow.ui
@@ -77,6 +77,7 @@
&Registers
+
@@ -128,6 +129,11 @@
Post register
+
+
+ Country register
+
+
diff --git a/core/gridform.h b/core/gridform.h
index 1b089d4..5164d87 100644
--- a/core/gridform.h
+++ b/core/gridform.h
@@ -81,6 +81,7 @@ public:
}
virtual void setTranslations(const QMap &translations) {
+ Q_ASSERT(m_tableModel != NULL);
m_tableModel->setTranslations(translations);
}
diff --git a/countryregister/countryregister.cpp b/countryregister/countryregister.cpp
new file mode 100644
index 0000000..c910852
--- /dev/null
+++ b/countryregister/countryregister.cpp
@@ -0,0 +1,18 @@
+#include "countryregister.h"
+
+#include "countryregistergrid.h"
+
+CountryRegister::CountryRegister()
+{
+}
+
+void CountryRegister::initServiceUi()
+{
+ m_service = new Service();
+ m_ui = new CountryRegisterGrid();
+}
+
+bool CountryRegister::showIcon()
+{
+ return false;
+}
diff --git a/countryregister/countryregister.h b/countryregister/countryregister.h
new file mode 100644
index 0000000..1ef0041
--- /dev/null
+++ b/countryregister/countryregister.h
@@ -0,0 +1,27 @@
+#ifndef COUNTRYREGISTER_H
+#define COUNTRYREGISTER_H
+
+#include "countryregister_global.h"
+#include
+#include
+
+class COUNTRYREGISTERSHARED_EXPORT CountryRegister : public QObject, IMetaDataPlugin
+{
+ Q_OBJECT
+
+ Q_PLUGIN_METADATA(IID PluginInterface_iid FILE "countryregister.json")
+ Q_INTERFACES(IPlugin)
+
+public:
+ CountryRegister();
+
+ // IMetaDataPlugin interface
+protected:
+ void initServiceUi();
+
+ // IPlugin interface
+public:
+ bool showIcon();
+};
+
+#endif // COUNTRYREGISTER_H
diff --git a/countryregister/countryregister.json b/countryregister/countryregister.json
new file mode 100644
index 0000000..de2fbe8
--- /dev/null
+++ b/countryregister/countryregister.json
@@ -0,0 +1,34 @@
+{
+ "id" : "COUNTRYREGISTER",
+ "name" : {
+ "default" : "Country register",
+ "CZ" : "Číselník zemí"
+ },
+ "descriptoin" : {
+ "default" : "",
+ "CZ" : ""
+ },
+ "schemaVersion" : 1,
+ "sql" : [
+ "CREATE TABLE \"CountryData\" (
+ \"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ \"code2\" TEXT NULL,
+ \"code3\" TEXT NULL,
+ \"czechFullName\" TEXT NULL,
+ \"czechName\" TEXT NULL,
+ \"englishFullName\" TEXT NULL,
+ \"englishName\" TEXT NULL);
+ "
+ ],
+ "dependencies" : [ ],
+ "translations" : {
+ "CZ" : {
+ "code2" : "Dvoupísmená zkratka",
+ "code3" : "Trojpísmená zkratka",
+ "czechFullName" : "Český název",
+ "czechName" : "Zkrácený český název",
+ "englishFullName" : "Anglický název",
+ "englishName" : "Zkrácený anglický název"
+ }
+ }
+}
diff --git a/countryregister/countryregister.pro b/countryregister/countryregister.pro
new file mode 100644
index 0000000..71763f2
--- /dev/null
+++ b/countryregister/countryregister.pro
@@ -0,0 +1,41 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2017-05-03T21:05:30
+#
+#-------------------------------------------------
+
+QT += widgets sql
+
+TARGET = countryregister
+TEMPLATE = lib
+
+DEFINES += COUNTRYREGISTER_LIBRARY
+
+# The following define makes your compiler emit warnings if you use
+# any feature of Qt which as been marked as deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if you use deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += countryregister.cpp \
+ countryregistergrid.cpp \
+ data/countrydata.cpp
+
+HEADERS += countryregister.h\
+ countryregister_global.h \
+ countryregistergrid.h \
+ data/countrydata.h
+
+include(../config_plugin.pri)
+
+ODB_FILES = countryregister/data/countrydata.h
+H_DIR = $$PWD/data/*.h
+include(../odb.pri)
+
+DISTFILES += \
+ countryregister.json
diff --git a/countryregister/countryregister_global.h b/countryregister/countryregister_global.h
new file mode 100644
index 0000000..a5fd140
--- /dev/null
+++ b/countryregister/countryregister_global.h
@@ -0,0 +1,12 @@
+#ifndef COUNTRYREGISTER_GLOBAL_H
+#define COUNTRYREGISTER_GLOBAL_H
+
+#include
+
+#if defined(COUNTRYREGISTER_LIBRARY)
+# define COUNTRYREGISTERSHARED_EXPORT Q_DECL_EXPORT
+#else
+# define COUNTRYREGISTERSHARED_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // COUNTRYREGISTER_GLOBAL_H
diff --git a/countryregister/countryregistergrid.cpp b/countryregister/countryregistergrid.cpp
new file mode 100644
index 0000000..4c74a80
--- /dev/null
+++ b/countryregister/countryregistergrid.cpp
@@ -0,0 +1,22 @@
+#include "countryregistergrid.h"
+#include "countryregister-odb.hxx"
+
+CountryRegisterGrid::CountryRegisterGrid(QWidget *parent) : GridForm(parent)
+{
+ setTableModel(new AutoTableModel());
+}
+
+bool CountryRegisterGrid::canAddRecord()
+{
+ return false;
+}
+
+bool CountryRegisterGrid::canEditRecord()
+{
+ return false;
+}
+
+bool CountryRegisterGrid::canDeleteRecord()
+{
+ return false;
+}
diff --git a/countryregister/countryregistergrid.h b/countryregister/countryregistergrid.h
new file mode 100644
index 0000000..d1addfd
--- /dev/null
+++ b/countryregister/countryregistergrid.h
@@ -0,0 +1,20 @@
+#ifndef COUNTRYREGISTERGRID_H
+#define COUNTRYREGISTERGRID_H
+
+#include
+#include "data/countrydata.h"
+
+class CountryRegisterGrid : public GridForm
+{
+
+public:
+ explicit CountryRegisterGrid(QWidget *parent = NULL);
+
+ // IGridForm interface
+protected:
+ bool canAddRecord();
+ bool canEditRecord();
+ bool canDeleteRecord();
+};
+
+#endif // COUNTRYREGISTERGRID_H
diff --git a/countryregister/data/countrydata.cpp b/countryregister/data/countrydata.cpp
new file mode 100644
index 0000000..3d37d13
--- /dev/null
+++ b/countryregister/data/countrydata.cpp
@@ -0,0 +1,76 @@
+#include "countrydata.h"
+
+CountryData::CountryData(QObject *parent) : QObject(parent)
+{
+
+}
+
+int CountryData::id() const
+{
+ return m_id;
+}
+
+void CountryData::setId(int id)
+{
+ m_id = id;
+}
+
+QString CountryData::code2() const
+{
+ return m_code2;
+}
+
+void CountryData::setCode2(const QString &code2)
+{
+ m_code2 = code2;
+}
+
+QString CountryData::code3() const
+{
+ return m_code3;
+}
+
+void CountryData::setCode3(const QString &code3)
+{
+ m_code3 = code3;
+}
+
+QString CountryData::czechFullName() const
+{
+ return m_czechFullName;
+}
+
+void CountryData::setCzechFullName(const QString &czechFullName)
+{
+ m_czechFullName = czechFullName;
+}
+
+QString CountryData::czechName() const
+{
+ return m_czechName;
+}
+
+void CountryData::setCzechName(const QString &czechName)
+{
+ m_czechName = czechName;
+}
+
+QString CountryData::englishFullName() const
+{
+ return m_englishFullName;
+}
+
+void CountryData::setEnglishFullName(const QString &englishFullName)
+{
+ m_englishFullName = englishFullName;
+}
+
+QString CountryData::englishName() const
+{
+ return m_englishName;
+}
+
+void CountryData::setEnglishName(const QString &englishName)
+{
+ m_englishName = englishName;
+}
diff --git a/countryregister/data/countrydata.h b/countryregister/data/countrydata.h
new file mode 100644
index 0000000..8b3e66d
--- /dev/null
+++ b/countryregister/data/countrydata.h
@@ -0,0 +1,55 @@
+#ifndef COUNTRYDATA_H
+#define COUNTRYDATA_H
+
+#include
+#include
+#include
+
+#pragma db object
+class CountryData : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString code2 READ code2 WRITE setCode2)
+ Q_PROPERTY(QString code3 READ code3 WRITE setCode3)
+ Q_PROPERTY(QString czechFullName READ czechFullName WRITE setCzechFullName)
+ Q_PROPERTY(QString czechName READ czechName WRITE setCzechName)
+ Q_PROPERTY(QString englishFullName READ englishFullName WRITE setEnglishFullName)
+ Q_PROPERTY(QString englishName READ englishName WRITE setEnglishName)
+public:
+ Q_INVOKABLE explicit CountryData(QObject *parent = 0);
+
+ int id() const;
+ void setId(int id);
+
+ QString code2() const;
+ void setCode2(const QString &code2);
+
+ QString code3() const;
+ void setCode3(const QString &code3);
+
+ QString czechFullName() const;
+ void setCzechFullName(const QString &czechFullName);
+
+ QString czechName() const;
+ void setCzechName(const QString &czechName);
+
+ QString englishFullName() const;
+ void setEnglishFullName(const QString &englishFullName);
+
+ QString englishName() const;
+ void setEnglishName(const QString &englishName);
+
+private:
+ friend class odb::access;
+#pragma db id auto
+ int m_id;
+ QString m_code2;
+ QString m_code3;
+ QString m_czechFullName;
+ QString m_czechName;
+ QString m_englishFullName;
+ QString m_englishName;
+
+};
+
+#endif // COUNTRYDATA_H
diff --git a/prodejna.pro b/prodejna.pro
index 5134588..a139d4f 100644
--- a/prodejna.pro
+++ b/prodejna.pro
@@ -10,5 +10,6 @@ SUBDIRS += \
shop \
commodity \
camp \
- postregister
+ postregister \
+ countryregister