diff --git a/OTPListModel.py b/OTPListModel.py index 98d82a1e414bbd2dba1ddd96cb4e4343da70b925..3d4e6d76792b8a5552cfa0d84d26d327d4087b87 100644 --- a/OTPListModel.py +++ b/OTPListModel.py @@ -1,4 +1,25 @@ from PySide2 import QtCore +class OTPModel(QtCore.QObject): + name="" + OTPType="" + secret="" + icon="" + def __init__(self,name="",OTPType="",secret="",icon=""): + self.name=name + self.OTPType=OTPType + self.secret=secret + self.icon=icon + + class OPTListModel(QtCore.QAbstractListModel): - pass \ No newline at end of file + _items=[] + def __init__(self,parent = None): + QtCore.QAbstractListModel.__init__(self, parent) + + def rowCount(self, parent=QtCore.QModelIndex()): + return len(self._items) + + def data(self, index, role=QtCore.Qt.DisplayRole): + if role == QtCore.Qt.DisplayRole: + return None \ No newline at end of file diff --git a/app.py b/app.py index 589e964641dcaaf7f55e8acd559b2f7c64f8bb9c..45dc3c5569c4bfe47770cbbe00c7fa604745b513 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,15 @@ from PySide2.QtQml import QQmlApplicationEngine from PySide2.QtWidgets import QApplication +import OTPListModel +import keyring +import json qapp = QApplication() -app = QQmlApplicationEngine("qml/main.qml") +app = QQmlApplicationEngine() +model = OTPListModel.OPTListModel() + +#keyring.set_password("test","boo","yeah") + +app.rootContext().setContextProperty("otpListModel", model) +app.load("qml/main.qml") qapp.exec_() diff --git a/qml/otplist.qml b/qml/otplist.qml index 355f731640c5d90e1575554b4e391d57d4139d21..980a599ab5d6de2dc0e001ccda7fdc31cc78ca7d 100644 --- a/qml/otplist.qml +++ b/qml/otplist.qml @@ -35,6 +35,18 @@ Item { } } ListView { - id:otpList + id: otpList + anchors.top: otpTimeout.bottom + anchors.right: parent.right + anchors.left: parent.left + anchors.bottom: parent.bottom + Component { + id: otpDelegate + Text { + text: "test" + } + } + model: otpListModel + delegate: otpDelegate } } \ No newline at end of file