Fixing ObjectAddOnContactPerson.qml conflict
This commit is contained in:
@@ -95,7 +95,10 @@ ColumnLayout
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted:
|
||||||
|
{
|
||||||
|
object_model.objectAdded.connect(onObjectAdded)
|
||||||
|
}
|
||||||
|
|
||||||
// Connections
|
// Connections
|
||||||
// {
|
// {
|
||||||
|
|||||||
17
Gui/CompanyConf.qml
Normal file
17
Gui/CompanyConf.qml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
property string name: "company"
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: qsTr("Das Unternehmen")
|
||||||
|
anchors.centerIn: parent
|
||||||
|
font.pixelSize: 57
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -231,6 +231,25 @@ GridLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component
|
||||||
|
{
|
||||||
|
id: highlight
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
width: 230; height: 15
|
||||||
|
color: "lightsteelblue"; radius: 5
|
||||||
|
y: contactView.currentItem.y
|
||||||
|
Behavior on y
|
||||||
|
{
|
||||||
|
SpringAnimation
|
||||||
|
{
|
||||||
|
spring: 3
|
||||||
|
damping: 0.2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
id: mainRect
|
id: mainRect
|
||||||
@@ -248,7 +267,6 @@ GridLayout
|
|||||||
header: headline
|
header: headline
|
||||||
highlight: Rectangle { color: "grey"}
|
highlight: Rectangle { color: "grey"}
|
||||||
highlightFollowsCurrentItem: false
|
highlightFollowsCurrentItem: false
|
||||||
|
|
||||||
onActiveFocusChanged: if(!focus) currentIndex = -1
|
onActiveFocusChanged: if(!focus) currentIndex = -1
|
||||||
delegate: Item
|
delegate: Item
|
||||||
{
|
{
|
||||||
@@ -263,6 +281,17 @@ GridLayout
|
|||||||
contactView.highlightFollowsCurrentItem = true
|
contactView.highlightFollowsCurrentItem = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
id: clickedRow
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
//var currentIndex = index
|
||||||
|
console.log(index)
|
||||||
|
console.log(contactView.currentItem.y)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Row
|
Row
|
||||||
{
|
{
|
||||||
@@ -297,6 +326,8 @@ GridLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ Item
|
|||||||
|
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
text: qsTr("Objekts zeigen")
|
text: qsTr("Zurück zu den Objekten")
|
||||||
onClicked: customersStack.pop()
|
onClicked: objectsStack.pop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
business_model.onRowClicked(selectedObject)
|
object_model.onRowClicked(selectedObject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ Item
|
|||||||
id: horizontalHeaderview
|
id: horizontalHeaderview
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
visible: false
|
//visible: false
|
||||||
movableColumns: true //@disable-check M16
|
movableColumns: true //@disable-check M16
|
||||||
syncView: objectTable
|
syncView: objectTable
|
||||||
|
|
||||||
@@ -68,36 +68,22 @@ Item
|
|||||||
id: objectTable
|
id: objectTable
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
columnSpacing: 1
|
||||||
|
rowSpacing: 2
|
||||||
|
model: object_model
|
||||||
|
alternatingRows: true
|
||||||
|
resizableColumns: true // @disable-check M16
|
||||||
|
selectionBehavior: TableView.SelectRows
|
||||||
ScrollBar.vertical: ScrollBar
|
ScrollBar.vertical: ScrollBar
|
||||||
{
|
{
|
||||||
policy: objectTable.contentHeight > objectTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
policy: objectTable.contentHeight > objectTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
||||||
}
|
}
|
||||||
columnSpacing: 1
|
|
||||||
rowSpacing: 2
|
|
||||||
//model: object_model
|
|
||||||
alternatingRows: true
|
|
||||||
resizableColumns: true // @disable-check M16
|
|
||||||
selectionBehavior: TableView.SelectRows
|
|
||||||
selectionModel: ItemSelectionModel
|
selectionModel: ItemSelectionModel
|
||||||
{
|
{
|
||||||
id: obmodel
|
id: obmodel
|
||||||
model: objectTable.model
|
model: objectTable.model
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timer
|
|
||||||
// {
|
|
||||||
// id: redrawTable
|
|
||||||
// running: true
|
|
||||||
// interval: 1
|
|
||||||
// repeat: false
|
|
||||||
// onTriggered:
|
|
||||||
// {
|
|
||||||
// objectTable.forceLayout();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
delegate:Rectangle
|
delegate:Rectangle
|
||||||
{
|
{
|
||||||
required property bool selected
|
required property bool selected
|
||||||
@@ -112,7 +98,7 @@ Item
|
|||||||
|
|
||||||
Text
|
Text
|
||||||
{
|
{
|
||||||
text: model.display === null? "": model.display
|
text: (model.display === null || model.display === undefined)? "": model.display
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|||||||
95
Gui/PyqcrmConf.qml
Normal file
95
Gui/PyqcrmConf.qml
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
TabBar
|
||||||
|
{
|
||||||
|
id: bar
|
||||||
|
width: parent.width
|
||||||
|
TabButton
|
||||||
|
{
|
||||||
|
text: qsTr("Benutzer")
|
||||||
|
}
|
||||||
|
TabButton
|
||||||
|
{
|
||||||
|
text: qsTr("Datenbank")
|
||||||
|
}
|
||||||
|
TabButton
|
||||||
|
{
|
||||||
|
text: qsTr("Das Unternehmen")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StackLayout
|
||||||
|
{
|
||||||
|
id: confContainer
|
||||||
|
anchors.fill: parent
|
||||||
|
currentIndex: bar.currentIndex
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: userTab
|
||||||
|
UsersPage
|
||||||
|
{
|
||||||
|
id: usersPage
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: dbTab
|
||||||
|
DbConfiguration
|
||||||
|
{
|
||||||
|
id: dbConf
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: companyTab
|
||||||
|
CompanyConf
|
||||||
|
{
|
||||||
|
id: companyConf
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
width: parent.width
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Button
|
||||||
|
{
|
||||||
|
text: qsTr("Ablehnen")
|
||||||
|
onClicked: appLoader.source = "Dashboard.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
Button
|
||||||
|
{
|
||||||
|
text: qsTr("Speichern")
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
switch (confContainer.currentIndex)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
console.log("Need to update DB paramenters")
|
||||||
|
break
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
console.log("Need to update company's info.")
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
console.log("Need to handle users")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -178,8 +178,15 @@ RowLayout
|
|||||||
id: mainMenu
|
id: mainMenu
|
||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
text: qsTr("Benutzer-Verwaltung")
|
//text: qsTr("Benutzer-Verwaltung")
|
||||||
onTriggered: appLoader.source = "UsersPage.qml"
|
//onTriggered: appLoader.source = "UsersPage.qml"
|
||||||
|
text: qsTr("Einstellungen")
|
||||||
|
onTriggered:
|
||||||
|
{
|
||||||
|
// TODO: Check if logged-in user is admin first!!
|
||||||
|
|
||||||
|
appLoader.source = "PyqcrmConf.qml"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MenuSeparator {}
|
MenuSeparator {}
|
||||||
MenuItem { text: qsTr("Als PDF exportieren") }
|
MenuItem { text: qsTr("Als PDF exportieren") }
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import QtQuick.Controls
|
|||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
|
property string name: "users"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
Label
|
Label
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from ..PyqcrmFlags import PyqcrmAppliEmpyFlags
|
|||||||
|
|
||||||
|
|
||||||
class ObjectDAO(QObject):
|
class ObjectDAO(QObject):
|
||||||
newObjectAdded = Signal()
|
newObjectAdded = Signal(bool)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@@ -20,7 +20,18 @@ class ObjectDAO(QObject):
|
|||||||
if self.__cur:
|
if self.__cur:
|
||||||
self.__cur.callproc("addObject", (json.dumps(new_object), json.dumps(new_objcontact), enc_key,))
|
self.__cur.callproc("addObject", (json.dumps(new_object), json.dumps(new_objcontact), enc_key,))
|
||||||
self.__con.commit()
|
self.__con.commit()
|
||||||
# self.newEmployeeAdded.emit()
|
self.newObjectAdded.emit(True)
|
||||||
|
except mariadb.Error as e:
|
||||||
|
self.newObjectAdded.emit(False)
|
||||||
|
print(str(e))
|
||||||
|
|
||||||
|
def getObjects(self, criterion, enc_key = None):
|
||||||
|
try:
|
||||||
|
if self.__cur:
|
||||||
|
self.__cur.callproc("getObjects", (criterion, enc_key,))
|
||||||
|
self.__all_cols = [desc[0] for desc in self.__cur.description]
|
||||||
|
return self.__cur.fetchall(), self.__all_cols
|
||||||
|
else:
|
||||||
|
return None, None
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
print(str(e))
|
print(str(e))
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import re
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
class ObjectModel(QAbstractTableModel):
|
class ObjectModel(QAbstractTableModel):
|
||||||
|
objectAdded = Signal(bool)
|
||||||
|
|
||||||
__data = None
|
__data = None
|
||||||
__object_dao = None
|
__object_dao = None
|
||||||
__visible_index = None
|
__visible_index = None
|
||||||
@@ -22,7 +24,8 @@ class ObjectModel(QAbstractTableModel):
|
|||||||
self.__object_dao.newObjectAdded.connect(self.__refreshView)
|
self.__object_dao.newObjectAdded.connect(self.__refreshView)
|
||||||
self.__conf = ConfigLoader().getConfig()
|
self.__conf = ConfigLoader().getConfig()
|
||||||
self.__key = self.__conf['pyqcrm']['ENCRYPTION_KEY']
|
self.__key = self.__conf['pyqcrm']['ENCRYPTION_KEY']
|
||||||
#self.__getData()
|
self.__object_dao.newObjectAdded.connect(self.objectAdded)
|
||||||
|
self.__getData()
|
||||||
|
|
||||||
@Slot(dict, list, bool)
|
@Slot(dict, list, bool)
|
||||||
def addObject(self, new_object, new_objcontact = None, new_contact = False):
|
def addObject(self, new_object, new_objcontact = None, new_contact = False):
|
||||||
@@ -30,7 +33,6 @@ class ObjectModel(QAbstractTableModel):
|
|||||||
|
|
||||||
print(new_objcontact)
|
print(new_objcontact)
|
||||||
|
|
||||||
|
|
||||||
self.__object_dao.addObject(new_object, new_objcontact, self.__key)
|
self.__object_dao.addObject(new_object, new_objcontact, self.__key)
|
||||||
|
|
||||||
# @Slot(str)
|
# @Slot(str)
|
||||||
@@ -41,54 +43,45 @@ class ObjectModel(QAbstractTableModel):
|
|||||||
def __refreshView(self):
|
def __refreshView(self):
|
||||||
self.__getData()
|
self.__getData()
|
||||||
|
|
||||||
# def __getData(self, criterion = "Alle", processed = False, fired = False, every_state = True):
|
def __getData(self, criterion = "Alle"):
|
||||||
# self.beginResetModel()
|
self.beginResetModel()
|
||||||
# rows, self.__visible_columns = self.__employee_dao.getEmployees(self.__key, criterion, processed, fired, every_state)
|
rows, self.__visible_columns = self.__object_dao.getObjects(criterion, self.__key)
|
||||||
# self.__data = rows
|
self.__data = rows
|
||||||
# self.endResetModel()
|
self.endResetModel()
|
||||||
|
|
||||||
# def rowCount(self, parent= QModelIndex()):
|
def rowCount(self, parent= QModelIndex()):
|
||||||
# return len (self.__data)
|
return len (self.__data)
|
||||||
|
|
||||||
# def columnCount(self, parent= QModelIndex()):
|
def columnCount(self, parent= QModelIndex()):
|
||||||
# return len(self.__visible_columns) - self.__col_skip
|
return len(self.__visible_columns) - self.__col_skip
|
||||||
|
|
||||||
# @Slot(str, bool, bool, bool)
|
@Slot(str)
|
||||||
# def viewCriterion(self, criterion, processed, fired, every_state):
|
def viewCriterion(self, criterion):
|
||||||
# self.__everyone = True if criterion == 'Alle' else False
|
self.__getData(criterion)
|
||||||
# if self.__everyone and criterion != "Alle":
|
|
||||||
# self.__col_skip = 2
|
|
||||||
# else:
|
|
||||||
# self.__col_skip = 2
|
|
||||||
# self.__getData(criterion, processed, fired, every_state)
|
|
||||||
|
|
||||||
# def data(self, index, role= Qt.DisplayRole):
|
def data(self, index, role= Qt.DisplayRole):
|
||||||
# if role == Qt.DisplayRole:
|
if role == Qt.DisplayRole:
|
||||||
# row = self.__data[index.row()]
|
row = self.__data[index.row()]
|
||||||
# applicant_col = index.column() + self.__col_skip
|
applicant_col = index.column() + self.__col_skip
|
||||||
# tr = row[applicant_col] #if type(row[index.column() + 2]) is str else str(row[index.column() + 2], "utf-8")
|
tr = row[applicant_col] #if type(row[index.column() + 2]) is str else str(row[index.column() + 2], "utf-8")
|
||||||
# if applicant_col == 2 and self.__everyone:
|
#print(f"Data: {tr}")
|
||||||
# tr = 'Ja' if tr == 1 else 'Nein'
|
# return row[index.column() + 2]
|
||||||
# else:
|
return tr
|
||||||
# tr = re.sub("Keine Angabe ","", tr)
|
return None
|
||||||
# #print(f"Data: {tr}")
|
|
||||||
# # return row[index.column() + 2]
|
|
||||||
# return tr
|
|
||||||
# return None
|
|
||||||
|
|
||||||
# def headerData(self, section, orientation, role = Qt.DisplayRole):
|
def headerData(self, section, orientation, role = Qt.DisplayRole):
|
||||||
# if orientation == Qt.Horizontal and role == Qt.DisplayRole:
|
if orientation == Qt.Horizontal and role == Qt.DisplayRole:
|
||||||
# self.__col_name = self.__visible_columns[section + self.__col_skip]
|
self.__col_name = self.__visible_columns[section + self.__col_skip]
|
||||||
# return self.__col_name
|
return self.__col_name
|
||||||
# return super().headerData(section, orientation, role)
|
return super().headerData(section, orientation, role)
|
||||||
|
|
||||||
# @Slot(int)
|
@Slot(int)
|
||||||
# def onRowClicked(self, row):
|
def onRowClicked(self, row):
|
||||||
# #print(self.__data)
|
#print(self.__data)
|
||||||
# print(f"Selected table row: {row}, corresponding DB ID: {self.__data[row][0]}")
|
print(f"Selected table row: {row}, corresponding DB ID: {self.__data[row][0]}")
|
||||||
# #if not self.__employee_dict['employee'] or self.__data[row][0] != self.__employee_dict['employee']['id']:
|
#if not self.__employee_dict['employee'] or self.__data[row][0] != self.__employee_dict['employee']['id']:
|
||||||
# #self.__employee = self.__employee_dao.getEmployee(self.__data[row][0], self.__key)
|
#self.__employee = self.__employee_dao.getEmployee(self.__data[row][0], self.__key)
|
||||||
# #print(self.__business)
|
#print(self.__business)
|
||||||
# #self.__getEmployeeInfo()
|
#self.__getEmployeeInfo()
|
||||||
# # self.__getContactInfo()
|
# self.__getContactInfo()
|
||||||
# # print(self.__business_dict)
|
# print(self.__business_dict)
|
||||||
|
|||||||
2
qml.qrc
2
qml.qrc
@@ -42,5 +42,7 @@
|
|||||||
<file>Gui/CustomerDetailsView.qml</file>
|
<file>Gui/CustomerDetailsView.qml</file>
|
||||||
<file>Gui/ReadMe.qml</file>
|
<file>Gui/ReadMe.qml</file>
|
||||||
<file>Gui/UsersPage.qml</file>
|
<file>Gui/UsersPage.qml</file>
|
||||||
|
<file>Gui/PyqcrmConf.qml</file>
|
||||||
|
<file>Gui/CompanyConf.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
Reference in New Issue
Block a user