summaryrefslogtreecommitdiff
path: root/client/pcpviewer
diff options
context:
space:
mode:
Diffstat (limited to 'client/pcpviewer')
-rw-r--r--client/pcpviewer/pcpdoc.cc73
-rw-r--r--client/pcpviewer/pcpdoc.h45
-rw-r--r--client/pcpviewer/pcpdocuments.cc72
-rw-r--r--client/pcpviewer/pcpdocuments.h54
-rw-r--r--client/pcpviewer/pcpimage.cc41
-rw-r--r--client/pcpviewer/pcpimage.h45
-rw-r--r--client/pcpviewer/pcpjournal.cc42
-rw-r--r--client/pcpviewer/pcpjournal.h47
-rw-r--r--client/pcpviewer/pcppatient.cc45
-rw-r--r--client/pcpviewer/pcppatient.h48
-rw-r--r--client/pcpviewer/pcpviewer.cc98
-rw-r--r--client/pcpviewer/pcpviewer.h12
12 files changed, 603 insertions, 19 deletions
diff --git a/client/pcpviewer/pcpdoc.cc b/client/pcpviewer/pcpdoc.cc
new file mode 100644
index 0000000..0d2aa41
--- /dev/null
+++ b/client/pcpviewer/pcpdoc.cc
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set et sw=2 ts=2: */
+/***************************************************************************
+ * pcpdoc.cc
+ *
+ * Thu Oct 20 11:56:32 CEST 2011
+ * Copyright 2011 Bent Bisballe Nyeng
+ * deva@aasimon.org
+ ****************************************************************************/
+
+/*
+ * This file is part of Pracro.
+ *
+ * Pracro is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Pracro is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Pracro; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#include "pcpdoc.h"
+
+#include <QTextCodec>
+#include <QByteArray>
+
+PCPDoc::PCPDoc(QString codepage)
+{
+ this->codepage = codepage;
+ setReadOnly(true);
+ setFontFamily("Courier New");
+}
+
+void PCPDoc::setText(QString text)
+{
+ QTextCodec *cp850 = QTextCodec::codecForName(codepage.toStdString().c_str());
+ if(!cp850) return;
+
+ QByteArray datacp850;
+ datacp850 += text;
+ QString j = cp850->toUnicode(datacp850);
+
+ QString jstrip;
+ for(int i = 0; i < j.length(); i++) {
+ if(j[i] != '\xb7') jstrip += j[i]; // Remove end of line symbols.
+ }
+
+ setPlainText(jstrip);
+}
+
+#ifdef TEST_PCPDOC
+//Additional dependency files
+//deps:
+//Required cflags (autoconf vars may be used)
+//cflags:
+//Required link options (autoconf vars may be used)
+//libs:
+#include "test.h"
+
+TEST_BEGIN;
+
+// TODO: Put some testcode here (see test.h for usable macros).
+TEST_TRUE(false, "No tests yet!");
+
+TEST_END;
+
+#endif/*TEST_PCPDOC*/
diff --git a/client/pcpviewer/pcpdoc.h b/client/pcpviewer/pcpdoc.h
new file mode 100644
index 0000000..ad48a26
--- /dev/null
+++ b/client/pcpviewer/pcpdoc.h
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set et sw=2 ts=2: */
+/***************************************************************************
+ * pcpdoc.h
+ *
+ * Thu Oct 20 11:56:32 CEST 2011
+ * Copyright 2011 Bent Bisballe Nyeng
+ * deva@aasimon.org
+ ****************************************************************************/
+
+/*
+ * This file is part of Pracro.
+ *
+ * Pracro is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Pracro is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Pracro; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#ifndef __PRACRO_PCPDOC_H__
+#define __PRACRO_PCPDOC_H__
+
+#include <QTextEdit>
+#include <QString>
+
+class PCPDoc : public QTextEdit {
+Q_OBJECT
+public:
+ PCPDoc(QString codepage);
+
+ void setText(QString text);
+
+private:
+ QString codepage;
+};
+
+#endif/*__PRACRO_PCPDOC_H__*/
diff --git a/client/pcpviewer/pcpdocuments.cc b/client/pcpviewer/pcpdocuments.cc
new file mode 100644
index 0000000..a6e39ac
--- /dev/null
+++ b/client/pcpviewer/pcpdocuments.cc
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set et sw=2 ts=2: */
+/***************************************************************************
+ * pcpdocuments.cc
+ *
+ * Thu Oct 20 09:11:18 CEST 2011
+ * Copyright 2011 Bent Bisballe Nyeng
+ * deva@aasimon.org
+ ****************************************************************************/
+
+/*
+ * This file is part of Pracro.
+ *
+ * Pracro is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Pracro is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Pracro; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#include "pcpdocuments.h"
+
+#include <QHBoxLayout>
+
+PCPDocuments::PCPDocuments()
+{
+ setLayout(new QHBoxLayout());
+ tree = new QTreeWidget(this);
+ layout()->addWidget(tree);
+
+ connect(tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
+ this, SLOT(dblclick(QTreeWidgetItem*,int)));
+
+ QStringList labels;
+ labels << "Group";
+ labels << "Subject";
+ labels << "Filename";
+ labels << "Size";
+ labels << "Date";
+ tree->setColumnCount(labels.size());
+ tree->setHeaderLabels(labels);
+
+}
+
+void PCPDocuments::setData(DokMenuVector d)
+{
+ DokMenuVector::iterator di = d.begin();
+ while(di != d.end()) {
+ QTreeWidgetItem *item = new QTreeWidgetItem();
+
+ item->setText(0, di->group);
+ item->setText(1, di->subject);
+ item->setText(2, di->filename);
+ item->setText(3, QString::number(di->filesize));
+ item->setText(4, di->date);
+
+ tree->addTopLevelItem(item);
+ di++;
+ }
+}
+
+void PCPDocuments::dblclick(QTreeWidgetItem *item, int)
+{
+ emit open(item->text(2));
+}
diff --git a/client/pcpviewer/pcpdocuments.h b/client/pcpviewer/pcpdocuments.h
new file mode 100644
index 0000000..ac14646
--- /dev/null
+++ b/client/pcpviewer/pcpdocuments.h
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set et sw=2 ts=2: */
+/***************************************************************************
+ * pcpdocuments.h
+ *
+ * Thu Oct 20 09:11:18 CEST 2011
+ * Copyright 2011 Bent Bisballe Nyeng
+ * deva@aasimon.org
+ ****************************************************************************/
+
+/*
+ * This file is part of Pracro.
+ *
+ * Pracro is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Pracro is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Pracro; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#ifndef __PRACRO_PCPDOCUMENTS_H__
+#define __PRACRO_PCPDOCUMENTS_H__
+
+#include <QWidget>
+#include <QTreeWidget>
+
+#include "praxisd.h"
+
+class PCPDocuments : public QWidget {
+Q_OBJECT
+public:
+ PCPDocuments();
+
+signals:
+ void open(QString name);
+
+public slots:
+ void setData(DokMenuVector d);
+
+private slots:
+ void dblclick(QTreeWidgetItem *item, int);
+
+private:
+ QTreeWidget *tree;
+};
+
+#endif/*__PRACRO_PCPDOCUMENTS_H__*/
diff --git a/client/pcpviewer/pcpimage.cc b/client/pcpviewer/pcpimage.cc
new file mode 100644
index 0000000..f3426b6
--- /dev/null
+++ b/client/pcpviewer/pcpimage.cc
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set et sw=2 ts=2: */
+/***************************************************************************
+ * pcpimage.cc
+ *
+ * Thu Oct 20 12:14:29 CEST 2011
+ * Copyright 2011 Bent Bisballe Nyeng
+ * deva@aasimon.org
+ ****************************************************************************/
+
+/*
+ * This file is part of Pracro.
+ *
+ * Pracro is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Pracro is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Pracro; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#include "pcpimage.h"
+
+PCPImage::PCPImage()
+{
+}
+
+void PCPImage::setData(QByteArray data)
+{
+ image = QImage::fromData(data);
+ image = image.scaled(1024, 1024,
+ Qt::KeepAspectRatio, Qt::SmoothTransformation);
+ setPixmap(QPixmap::fromImage(image));
+ resize(image.width(), image.height());
+}
diff --git a/client/pcpviewer/pcpimage.h b/client/pcpviewer/pcpimage.h
new file mode 100644
index 0000000..696a016
--- /dev/null
+++ b/client/pcpviewer/pcpimage.h
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set et sw=2 ts=2: */
+/***************************************************************************
+ * pcpimage.h
+ *
+ * Thu Oct 20 12:14:29 CEST 2011
+ * Copyright 2011 Bent Bisballe Nyeng
+ * deva@aasimon.org
+ ****************************************************************************/
+
+/*
+ * This file is part of Pracro.
+ *
+ * Pracro is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Pracro is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Pracro; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#ifndef __PRACRO_PCPIMAGE_H__
+#define __PRACRO_PCPIMAGE_H__
+
+#include <QLabel>
+#include <QByteArray>
+
+class PCPImage : public QLabel {
+Q_OBJECT
+public:
+ PCPImage();
+
+ void setData(QByteArray data);
+
+private:
+ QImage image;
+};
+
+#endif/*__PRACRO_PCPIMAGE_H__*/
diff --git a/client/pcpviewer/pcpjournal.cc b/client/pcpviewer/pcpjournal.cc
new file mode 100644
index 0000000..0ebaf4b
--- /dev/null
+++ b/client/pcpviewer/pcpjournal.cc
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set et sw=2 ts=2: */
+/***************************************************************************
+ * pcpjournal.cc
+ *
+ * Wed Oct 19 11:52:31 CEST 2011
+ * Copyright 2011 Bent Bisballe Nyeng
+ * deva@aasimon.org
+ ****************************************************************************/
+
+/*
+ * This file is part of Pracro.
+ *
+ * Pracro is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Pracro is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Pracro; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#include "pcpjournal.h"
+
+#include <QHBoxLayout>
+
+PCPJournal::PCPJournal()
+{
+ setLayout(new QHBoxLayout());
+ doc = new PCPDoc("utf8");
+ layout()->addWidget(doc);
+}
+
+void PCPJournal::setData(QString data)
+{
+ doc->setText(data);
+}
diff --git a/client/pcpviewer/pcpjournal.h b/client/pcpviewer/pcpjournal.h
new file mode 100644
index 0000000..0a9cff2
--- /dev/null
+++ b/client/pcpviewer/pcpjournal.h
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set et sw=2 ts=2: */
+/***************************************************************************
+ * pcpjournal.h
+ *
+ * Wed Oct 19 11:52:31 CEST 2011
+ * Copyright 2011 Bent Bisballe Nyeng
+ * deva@aasimon.org
+ ****************************************************************************/
+
+/*
+ * This file is part of Pracro.
+ *
+ * Pracro is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Pracro is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Pracro; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#ifndef __PRACRO_PCPJOURNAL_H__
+#define __PRACRO_PCPJOURNAL_H__
+
+#include <QWidget>
+
+#include "pcpdoc.h"
+
+class PCPJournal : public QWidget {
+Q_OBJECT
+public:
+ PCPJournal();
+
+public slots:
+ void setData(QString);
+
+private:
+ PCPDoc *doc;
+};
+
+#endif/*__PRACRO_PCPJOURNAL_H__*/
diff --git a/client/pcpviewer/pcppatient.cc b/client/pcpviewer/pcppatient.cc
new file mode 100644
index 0000000..5ba1845
--- /dev/null
+++ b/client/pcpviewer/pcppatient.cc
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set et sw=2 ts=2: */
+/***************************************************************************
+ * pcppatient.cc
+ *
+ * Thu Oct 20 09:11:08 CEST 2011
+ * Copyright 2011 Bent Bisballe Nyeng
+ * deva@aasimon.org
+ ****************************************************************************/
+
+/*
+ * This file is part of Pracro.
+ *
+ * Pracro is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Pracro is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Pracro; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#include "pcppatient.h"
+
+#include <QHBoxLayout>
+
+PCPPatient::PCPPatient()
+{
+ setLayout(new QHBoxLayout());
+ j = new QLineEdit(this);
+ layout()->addWidget(j);
+}
+
+void PCPPatient::setData(Patient p)
+{
+ QString s;
+ s += p.cpr+ ": " + p.fornavne + " " + p.efternavn;
+ j->setText(s);
+}
+
diff --git a/client/pcpviewer/pcppatient.h b/client/pcpviewer/pcppatient.h
new file mode 100644
index 0000000..6f2a740
--- /dev/null
+++ b/client/pcpviewer/pcppatient.h
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set et sw=2 ts=2: */
+/***************************************************************************
+ * pcppatient.h
+ *
+ * Thu Oct 20 09:11:08 CEST 2011
+ * Copyright 2011 Bent Bisballe Nyeng
+ * deva@aasimon.org
+ ****************************************************************************/
+
+/*
+ * This file is part of Pracro.
+ *
+ * Pracro is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Pracro is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Pracro; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#ifndef __PRACRO_PCPPATIENT_H__
+#define __PRACRO_PCPPATIENT_H__
+
+#include <QWidget>
+#include <QLineEdit>
+
+#include "praxisd.h"
+
+class PCPPatient : public QWidget {
+Q_OBJECT
+public:
+ PCPPatient();
+
+public slots:
+ void setData(Patient p);
+
+private:
+ QLineEdit *j;
+};
+
+#endif/*__PRACRO_PCPPATIENT_H__*/
diff --git a/client/pcpviewer/pcpviewer.cc b/client/pcpviewer/pcpviewer.cc
index 739a681..5853e0a 100644
--- a/client/pcpviewer/pcpviewer.cc
+++ b/client/pcpviewer/pcpviewer.cc
@@ -27,40 +27,102 @@
*/
#include "pcpviewer.h"
-#include <stdio.h>
+#include <QVBoxLayout>
-PCPViewer::PCPViewer(QString patientid) : praxisd("localhost", 10000)
+#include <QTextCodec>
+
+#include "pcppatient.h"
+#include "pcpjournal.h"
+#include "pcpdocuments.h"
+#include "pcpdoc.h"
+#include "pcpimage.h"
+
+#include <QSplitter>
+#include <QSettings>
+
+PCPViewer::PCPViewer(QString patientid) : praxisd("sarge", 10000)
{
this->patientid = patientid;
+ setLayout(new QVBoxLayout());
+
connect(&praxisd, SIGNAL(networkError(QString)),
this, SLOT(networkError(QString)));
- /*
+ PCPPatient *patient = new PCPPatient();
+ layout()->addWidget(patient);
connect(&praxisd, SIGNAL(gotPatient(Patient)),
- this, SLOT(gotPatient(Patient)));
- */
+ patient, SLOT(setData(Patient)));
+
+ split = new QSplitter(Qt::Vertical);
+
+ PCPJournal *journal = new PCPJournal();
+ split->addWidget(journal);
+ connect(&praxisd, SIGNAL(gotJournal(QString)),
+ journal, SLOT(setData(QString)));
+
+ PCPDocuments *documents = new PCPDocuments();
+ split->addWidget(documents);
connect(&praxisd, SIGNAL(gotDokMenu(DokMenuVector)),
- this, SLOT(gotDokMenu(DokMenuVector)));
+ documents, SLOT(setData(DokMenuVector)));
+ connect(documents, SIGNAL(open(QString)),
+ this, SLOT(open(QString)));
+ connect(&praxisd, SIGNAL(gotDokMenuFile(QByteArray, QString)),
+ this, SLOT(gotDokMenuFile(QByteArray, QString)));
+
+ layout()->addWidget(split);
+
+ init();
+ praxisd.journal_get_by_cpr(patientid);
+ praxisd.patient_get_by_cpr(patientid);
praxisd.dokmenu_get_all_by_cpr(patientid);
}
-void PCPViewer::networkError(QString text)
+void PCPViewer::networkError(QString)
+{
+ // printf("ERROR: %s\n", text.toStdString().c_str());
+}
+
+void PCPViewer::open(QString name)
{
- printf("ERROR: %s\n", text.toStdString().c_str());
+ praxisd.dokmenu_get_by_cpr_and_name(patientid, name);
}
-void PCPViewer::gotDokMenu(DokMenuVector d)
+void PCPViewer::gotDokMenuFile(QByteArray data, QString mimetype)
{
- DokMenuVector::iterator di = d.begin();
- while(di != d.end()) {
- printf("%s %s %s %d %s\n",
- di->group.toStdString().c_str(),
- di->subject.toStdString().c_str(),
- di->filename.toStdString().c_str(),
- di->filesize,
- di->date.toStdString().c_str());
- di++;
+ if(mimetype == "image/jpeg; charset=binary") {
+ PCPImage *img = new PCPImage();
+ img->setData(data);
+ img->show();
}
+
+ if(mimetype == "text/plain; charset=cp850") {
+ PCPDoc *doc = new PCPDoc("cp850");
+ doc->setText(data);
+ doc->resize(600, 750);
+ doc->show();
+ }
+}
+
+void PCPViewer::closeEvent(QCloseEvent *event)
+{
+ QSettings settings("Aasimon.org", "PCPViewer");
+
+ settings.beginGroup("MainWindow");
+ settings.setValue("geometry", saveGeometry());
+ settings.setValue("split", split->saveState());
+ settings.endGroup();
+
+ event->accept();
+}
+
+void PCPViewer::init()
+{
+ QSettings settings("Aasimon.org", "PCPViewer");
+
+ settings.beginGroup("MainWindow");
+ restoreGeometry(settings.value("geometry").toByteArray());
+ split->restoreState(settings.value("split").toByteArray());
+ settings.endGroup();
}
diff --git a/client/pcpviewer/pcpviewer.h b/client/pcpviewer/pcpviewer.h
index 35459a1..81a97bf 100644
--- a/client/pcpviewer/pcpviewer.h
+++ b/client/pcpviewer/pcpviewer.h
@@ -30,6 +30,9 @@
#include <QWidget>
+#include <QSplitter>
+#include <QCloseEvent>
+
#include "praxisd.h"
class PCPViewer : public QWidget {
@@ -37,13 +40,20 @@ Q_OBJECT
public:
PCPViewer(QString patientid);
+protected:
+ void closeEvent(QCloseEvent *event);
+
public slots:
void networkError(QString text);
- void gotDokMenu(DokMenuVector d);
+ void open(QString name);
+ void gotDokMenuFile(QByteArray data, QString mimetype);
private:
+ void init();
+
Praxisd praxisd;
QString patientid;
+ QSplitter *split;
};
#endif/*__PRACRO_PCPVIEWER_H__*/