summaryrefslogtreecommitdiff
blob: 04ec9b34e1f722b6696f2b370ec9b936299d8747 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
bugs.gentoo.org #99643, bugs.kde.org #106274, in upstream BRANCH post 3.4.2

Index: kmailcvt/filters.hxx
===================================================================
--- kmailcvt/filters.hxx	(revision 438560)
+++ kmailcvt/filters.hxx	(revision 438561)
@@ -85,6 +85,57 @@
 };
 
 
+
+/** 
+* Glorified QString[N] for (a) understandability (b) older gcc compatibility. 
+*/
+template <unsigned int size> class FolderStructureBase
+{
+public:
+	typedef QString NString[size];
+	/** Constructor. Need a default constructor for QValueList. */
+	FolderStructureBase() {} ;
+
+	/** Constructor. Turn N QStrings into a folder structure 
+	*   description. 
+	*/
+	FolderStructureBase(const NString &s)
+	{
+	    for(unsigned int i=0; i<size; i++) d[i]=s[i];
+	} ;
+
+	/** Copy Constructor. */
+	FolderStructureBase(const FolderStructureBase &s)
+	{
+	    for(unsigned int i=0; i<size; i++) d[i]=s[i];
+	} ;
+
+	/** Assignment operator. Does the same thing as 
+	*   the copy constructor.
+	*/
+	FolderStructureBase &operator =(const FolderStructureBase &s)
+	{
+	    for(unsigned int i=0; i<size; i++) d[i]=s[i];
+	    return *this;
+	} ;
+
+	/** Access the different fields. There doesn't seem to
+	*   be a real semantics for the fields.
+	*/
+	const QString operator [](unsigned int i) const
+	{
+	    if (i<size) return d[i]; else return QString::null;
+	} ;
+
+	/** Access the different fields, for writing. */
+	QString &operator [](unsigned int i)
+	{
+	    Q_ASSERT(i<size);
+	    if (i<size) return d[i]; else return d[0];
+	} ;
+private:
+	QString d[size];
+} ;
+
 #endif
 
-// vim: ts=2 sw=2 et
Index: kmailcvt/filter_pmail.cxx
===================================================================
--- kmailcvt/filter_pmail.cxx	(revision 438560)
+++ kmailcvt/filter_pmail.cxx	(revision 438561)
@@ -325,8 +325,8 @@
     
     while (!found)
     {
-        for ( QValueList<QString[5]>::Iterator it = folderMatrix.begin(); it != folderMatrix.end(); it++) {
-            QString tmp[5] = *it;
+        for ( FolderStructureIterator it = folderMatrix.begin(); it != folderMatrix.end(); it++) {
+            FolderStructure tmp = *it;
             
             QString _ID = tmp[2];
             if(_ID == search) {
Index: kmailcvt/filter_oe.cxx
===================================================================
--- kmailcvt/filter_oe.cxx	(revision 438560)
+++ kmailcvt/filter_oe.cxx	(revision 438561)
@@ -389,15 +389,15 @@
 {
     bool found = false;
     bool foundFilename = false;
-    QString folder = "";
+    QString folder;
     // we must do this because folder with more than one upper letter
     // at start have maybe not a file named like the folder !!!
     QString search = filename.lower();
     
     while (!found)
     {
-        for ( QValueList<QString[4]>::Iterator it = folderStructure.begin(); it != folderStructure.end(); it++) {
-            QString tmp[4] = *it;
+        for ( FolderStructureIterator it = folderStructure.begin(); it != folderStructure.end(); it++) {
+            FolderStructure tmp = *it;
             if(foundFilename == false) {
                 QString _tmpFileName = tmp[1];
                 _tmpFileName = _tmpFileName.lower();
@@ -410,7 +410,7 @@
                 QString _currentID = tmp[2];
                 QString _parentID = tmp[3];
                 if(_currentID == search) {
-                    if(_parentID == "") { // this is the root of the folder
+                    if(_parentID.isEmpty()) { // this is the root of the folder
                         found = true;
                         break;
                     } else {
@@ -421,7 +421,7 @@
             }
         }
         // need to break the while loop maybe in some cases
-        if((foundFilename == false) && (folder == "")) return folder;
+        if((foundFilename == false) && (folder.isEmpty())) return folder;
     }
     return folder;
 }
Index: kmailcvt/filter_pmail.hxx
===================================================================
--- kmailcvt/filter_pmail.hxx	(revision 438560)
+++ kmailcvt/filter_pmail.hxx	(revision 438561)
@@ -50,8 +50,18 @@
     QDir dir;
     /**  pointer to the info */
     FilterInfo * inf;
-    /** QStringList with the foldernames, First String contains the ID, the second the folder */
-    QValueList<QString[5]> folderMatrix;
+
+    /** Folder structure here has 5 entries. */
+    typedef FolderStructureBase<5> FolderStructure;
+    /** List with the folder matrix, which contains following strings:
+	1. type (2 for root-folder, 1 for folder, 0 for mailarchiv)
+	2. type (1 for root-folder, 3 for folder, 0 for mailarchiv)  
+	3. "ID:flag:filename" of folder/archiv   
+	4. "ID:name" of parent folder
+	5. name of folder/archiv
+    */
+    QValueList<FolderStructure> folderMatrix;
+    typedef QValueList<FolderStructure>::Iterator FolderStructureIterator;
     
     /** true, if the folderfile is parsed **/
     bool folderParsed;
Index: kmailcvt/filter_oe.hxx
===================================================================
--- kmailcvt/filter_oe.hxx	(revision 438560)
+++ kmailcvt/filter_oe.hxx	(revision 438561)
@@ -61,8 +61,17 @@
     bool parsedFolder;
     /** true if the current parsing file is the folder file */
     bool currentIsFolderFile;
+
+    /** Folder structure with following  4 entries:
+        1. descriptive folder name 
+        2. filename 
+        3. ID of current folder
+        4. ID of parent folder 
+    */
+    typedef FolderStructureBase<4> FolderStructure;
     /** matrix with information about the folder structure*/
-    QValueList<QString[4]> folderStructure;
+    QValueList<FolderStructure> folderStructure;
+    typedef QValueList<FolderStructure>::Iterator FolderStructureIterator;
 
     /** name of the current folder */
     QString folderName;