summaryrefslogtreecommitdiffabout
path: root/microkde
Unidiff
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kidmanager.cpp10
-rw-r--r--microkde/kidmanager.h10
2 files changed, 10 insertions, 10 deletions
diff --git a/microkde/kidmanager.cpp b/microkde/kidmanager.cpp
index e687e5d..d712771 100644
--- a/microkde/kidmanager.cpp
+++ b/microkde/kidmanager.cpp
@@ -1,98 +1,98 @@
1#include "kidmanager.h" 1#include "kidmanager.h"
2 2
3KIdManager::KIdManager() 3KIdManager::KIdManager()
4{ 4{
5 5
6} 6}
7// :profilename;12;id_withLen12;123456: 7// :profilename;12;id_withLen12;123456:
8// 123456 is the csum 8// 123456 is the csum
9QString KIdManager::setId (const QString& idString,const QString& prof,const QString& idvalue ) 9const QString KIdManager::setId (const QString& idString,const QString& prof,const QString& idvalue )
10{ 10{
11 int startProf; 11 int startProf;
12 int startIDnum; 12 int startIDnum;
13 int startIDnumlen; 13 int startIDnumlen;
14 int startID; 14 int startID;
15 int lenID; 15 int lenID;
16 int startCsum; 16 int startCsum;
17 int lenCsum; 17 int lenCsum;
18 int endall; 18 int endall;
19 QString newIDString; 19 QString newIDString;
20 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { 20 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) {
21 newIDString = idString.left(startIDnum ) + QString::number( idvalue.length() ) +";"+idvalue+ ";"+idString.mid( startCsum ); 21 newIDString = idString.left(startIDnum ) + QString::number( idvalue.length() ) +";"+idvalue+ ";"+idString.mid( startCsum );
22 } else { 22 } else {
23 newIDString = idString + prof+";"+ QString::number( idvalue.length() ) +";"+idvalue +";0:"; 23 newIDString = idString + prof+";"+ QString::number( idvalue.length() ) +";"+idvalue +";0:";
24 } 24 }
25 //qDebug("setID:profile:%s*retval:%s*idvalue:%s* ", prof.latin1(), newIDString.latin1() ,idvalue.latin1() ); 25 //qDebug("setID:profile:%s*retval:%s*idvalue:%s* ", prof.latin1(), newIDString.latin1() ,idvalue.latin1() );
26 return newIDString; 26 return newIDString;
27} 27}
28QString KIdManager::getId (const QString& idString,const QString& prof ) 28const QString KIdManager::getId (const QString& idString,const QString& prof )
29{ 29{
30 int startProf; 30 int startProf;
31 int startIDnum; 31 int startIDnum;
32 int startIDnumlen; 32 int startIDnumlen;
33 int startID; 33 int startID;
34 int lenID; 34 int lenID;
35 int startCsum; 35 int startCsum;
36 int lenCsum; 36 int lenCsum;
37 int endall; 37 int endall;
38 QString idval = ""; 38 QString idval = "";
39 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) 39 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) )
40 idval = idString.mid( startID, lenID ); 40 idval = idString.mid( startID, lenID );
41 41
42 //qDebug("getID:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() ); 42 //qDebug("getID:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() );
43 return idval; 43 return idval;
44 44
45} 45}
46 46
47QString KIdManager::removeId (const QString& idString,const QString& prof ) 47const QString KIdManager::removeId (const QString& idString,const QString& prof )
48{ 48{
49 int startProf; 49 int startProf;
50 int startIDnum; 50 int startIDnum;
51 int startIDnumlen; 51 int startIDnumlen;
52 int startID; 52 int startID;
53 int lenID; 53 int lenID;
54 int startCsum; 54 int startCsum;
55 int lenCsum; 55 int lenCsum;
56 int endall; 56 int endall;
57 QString newIDString; 57 QString newIDString;
58 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { 58 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) {
59 newIDString = idString.left(startProf) + idString.mid( endall+1 ); 59 newIDString = idString.left(startProf) + idString.mid( endall+1 );
60 } else { 60 } else {
61 newIDString = idString; 61 newIDString = idString;
62 } 62 }
63 //qDebug("removeID:profile:%s*retval:%s*oldidstring:%s* ", prof.latin1(), newIDString.latin1() ,idString.latin1() ); 63 //qDebug("removeID:profile:%s*retval:%s*oldidstring:%s* ", prof.latin1(), newIDString.latin1() ,idString.latin1() );
64 return newIDString; 64 return newIDString;
65} 65}
66 66
67QString KIdManager::setCsum (const QString& idString,const QString& prof,const QString& idCsum ) 67const QString KIdManager::setCsum (const QString& idString,const QString& prof,const QString& idCsum )
68{ 68{
69 int startProf; 69 int startProf;
70 int startIDnum; 70 int startIDnum;
71 int startIDnumlen; 71 int startIDnumlen;
72 int startID; 72 int startID;
73 int lenID; 73 int lenID;
74 int startCsum; 74 int startCsum;
75 int lenCsum; 75 int lenCsum;
76 int endall; 76 int endall;
77 QString newIDString; 77 QString newIDString;
78 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { 78 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) {
79 newIDString = idString.left(startCsum) + idCsum+ idString.mid( endall +1); 79 newIDString = idString.left(startCsum) + idCsum+ idString.mid( endall +1);
80 } else { 80 } else {
81 newIDString = idString + prof + ";3;_u_;"+ idCsum + ":"; 81 newIDString = idString + prof + ";3;_u_;"+ idCsum + ":";
82 } 82 }
83 //qDebug("setCsum:profile:%s*retval:%s*idCsum:%s* ", prof.latin1(), newIDString.latin1() ,idCsum.latin1() ); 83 //qDebug("setCsum:profile:%s*retval:%s*idCsum:%s* ", prof.latin1(), newIDString.latin1() ,idCsum.latin1() );
84 return newIDString; 84 return newIDString;
85} 85}
86QString KIdManager::getCsum (const QString& idString,const QString& prof ) 86const QString KIdManager::getCsum (const QString& idString,const QString& prof )
87{ 87{
88 int startProf; 88 int startProf;
89 int startIDnum; 89 int startIDnum;
90 int startIDnumlen; 90 int startIDnumlen;
91 int startID; 91 int startID;
92 int lenID; 92 int lenID;
93 int startCsum; 93 int startCsum;
94 int lenCsum; 94 int lenCsum;
95 int endall; 95 int endall;
96 QString idval = ""; 96 QString idval = "";
97 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) 97 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) )
98 idval = idString.mid( startCsum, lenCsum ); 98 idval = idString.mid( startCsum, lenCsum );
diff --git a/microkde/kidmanager.h b/microkde/kidmanager.h
index 00580a0..9786c9f 100644
--- a/microkde/kidmanager.h
+++ b/microkde/kidmanager.h
@@ -1,24 +1,24 @@
1#ifndef MINIKDE_KIDMANAGER_H 1#ifndef MINIKDE_KIDMANAGER_H
2#define MINIKDE_KIDMANAGER_H 2#define MINIKDE_KIDMANAGER_H
3 3
4#include <qstring.h> 4#include <qstring.h>
5 5
6#include <qobject.h> 6#include <qobject.h>
7class KIdManager : public QObject 7class KIdManager : public QObject
8{ 8{
9Q_OBJECT 9Q_OBJECT
10 public: 10 public:
11 KIdManager( ); 11 KIdManager( );
12 static QString setId (const QString& idString,const QString& id,const QString& idvalue ) ; 12 static const QString setId (const QString& idString,const QString& id,const QString& idvalue ) ;
13 static QString getId (const QString& idString,const QString& id ) ; 13 static const QString getId (const QString& idString,const QString& id ) ;
14 static QString removeId (const QString& idString,const QString& id ) ; 14 static const QString removeId (const QString& idString,const QString& id ) ;
15 static QString setCsum (const QString& idString,const QString& id,const QString& idvalue ) ; 15 static const QString setCsum (const QString& idString,const QString& id,const QString& idvalue ) ;
16 static QString getCsum (const QString& idString,const QString& id ) ; 16 static const QString getCsum (const QString& idString,const QString& id ) ;
17 static bool getNumbers (const QString& idString,const QString& id, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall) ; 17 static bool getNumbers (const QString& idString,const QString& id, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall) ;
18 private: 18 private:
19 19
20private slots: 20private slots:
21}; 21};
22 22
23 23
24#endif 24#endif