summaryrefslogtreecommitdiffstats
path: root/src/knutupsdata.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-19 18:17:02 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-19 18:17:02 +0000
commitf867212c1762e156553d039319b904a17f7b563d (patch)
tree461c1a743b3ff8291e03360742dbbfb4cc0087e4 /src/knutupsdata.cpp
downloadknutclient-f867212c1762e156553d039319b904a17f7b563d.tar.gz
knutclient-f867212c1762e156553d039319b904a17f7b563d.zip
Added KDE3 version of knutclient
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knutclient@1092914 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/knutupsdata.cpp')
-rw-r--r--src/knutupsdata.cpp78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/knutupsdata.cpp b/src/knutupsdata.cpp
new file mode 100644
index 0000000..9a4a0b5
--- /dev/null
+++ b/src/knutupsdata.cpp
@@ -0,0 +1,78 @@
+/***************************************************************************
+ knutupsdata.cpp - description
+ -------------------
+ begin : Tue Aug 21 2001
+ copyright : (C) 2001 by Daniel Prynych
+ email : Daniel.Prynych@alo.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program 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. *
+ * *
+ ***************************************************************************/
+
+#include "knutupsdata.h"
+#include "knutvardata.h"
+
+#include <qstring.h>
+
+
+KNutUpsData::KNutUpsData() {
+// vytvori seznam UPS
+ m_listRecords.clear();
+ m_countUpsRecords = 0;
+ }
+
+KNutUpsData::~KNutUpsData() { m_listRecords.clear(); }
+
+void KNutUpsData::add (const upsRecordDef upsRecord) {
+// vlozime ups na konec
+ m_countUpsRecords++;
+ m_listRecords.append(upsRecord);
+ }
+
+
+void KNutUpsData::put (const int index, const upsRecordDef upsRecord ) {
+ if ((index > -1 ) && (index < m_countUpsRecords)) {
+ m_listRecords[index] = (upsRecord);
+ }
+ }
+
+
+void KNutUpsData::get (const int index, upsRecordDef& upsRecord ) {
+ if ((index > -1 ) && (index < m_countUpsRecords)) upsRecord=m_listRecords[index];
+ }
+
+QString KNutUpsData::getName (const int index) {
+ if ((index > -1 ) && (index < m_countUpsRecords)) return m_listRecords[index].name;
+ else return 0L;
+ }
+
+
+void KNutUpsData::deleteName (const int index) {
+ if ((index > -1 ) && (index < m_countUpsRecords)) {
+ QValueList<upsRecordDef>::Iterator it = m_listRecords.begin();
+ for (int i =0; i < index; i++) it++;
+ m_listRecords.remove(it);
+ m_countUpsRecords--;
+ }
+}
+
+
+int KNutUpsData::getCount ( void ) { return m_countUpsRecords; }
+
+
+KNutUpsData::upsRecordDef* KNutUpsData::findName (const QString name) {
+ QValueList<upsRecordDef>::Iterator it;
+ for (it = m_listRecords.begin(); it != m_listRecords.end(); it++) {
+ if ((*it).name == name) {
+ return &(*it); // vratime adresu
+ }
+ }
+ return 0l;
+ }
+