summaryrefslogtreecommitdiff
path: root/tests/01uni_multi.patch
blob: ba5939ccc3cbfc6412b949e82ba44079d6963a33 (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
170
171
172
173
174
175
176
177
178
179
180
Index: updatedlg.cpp
===================================================================
--- updatedlg.cpp	(revision 5095)
+++ updatedlg.cpp	(working copy)
@@ -94,11 +94,13 @@
     lst->InsertColumn(1, _("Version"));
     lst->InsertColumn(2, _("Installed"));
     lst->InsertColumn(3, _("Size"), wxLIST_FORMAT_RIGHT);
+    lst->InsertColumn(4, _("Rev"));
 
-    lst->SetColumnWidth(0, lst->GetSize().x - (64 * 3) - 2); // 1st column takes all remaining space
+    lst->SetColumnWidth(0, lst->GetSize().x - (64 * 3 + 40) - 6 ); // 1st column takes all remaining space
     lst->SetColumnWidth(1, 64);
     lst->SetColumnWidth(2, 64);
     lst->SetColumnWidth(3, 64);
+    lst->SetColumnWidth(4, 40);
 }
 
 void UpdateDlg::AddRecordToList(UpdateRec* rec)
@@ -111,8 +113,20 @@
     lst->SetItem(idx, 1, rec->version);
     lst->SetItem(idx, 2, rec->installed_version);
     lst->SetItem(idx, 3, rec->size);
+    lst->SetItem(idx, 4, rec->revision);
 }
 
+wxString UpdateDlg::GetListColumnText(int idx, int col) {
+    wxListCtrl* lst = XRCCTRL(*this, "lvFiles", wxListCtrl);
+    int index = idx == -1 ? lst->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED) : idx;
+    wxListItem info;
+    info.SetId(index);
+    info.SetColumn(col);
+    info.SetMask(wxLIST_MASK_TEXT);
+    lst->GetItem(info);
+    return info.GetText();
+}
+
 void UpdateDlg::SetListColumnText(int idx, int col, const wxString& text)
 {
     wxListCtrl* lst = XRCCTRL(*this, "lvFiles", wxListCtrl);
@@ -393,7 +407,9 @@
     if (index == -1)
         return 0;
     wxString title = lst->GetItemText(index);
-    return FindRecByTitle(title, m_Recs, m_RecsCount);
+    wxString version = GetListColumnText(index, 1);
+    wxString revision = GetListColumnText(index, 4);
+    return FindRec(title, version, revision, m_Recs, m_RecsCount);
 }
 
 void UpdateDlg::DownloadFile(bool dontInstall)
Index: updatedlg.h
===================================================================
--- updatedlg.h	(revision 5095)
+++ updatedlg.h	(working copy)
@@ -49,6 +49,7 @@
         UpdateRec* GetRecFromListView();
         void CreateListColumns();
         void AddRecordToList(UpdateRec* rec);
+        wxString GetListColumnText(int idx, int col);
         void SetListColumnText(int idx, int col, const wxString& text);
 
         wxString GetConfFilename();
Index: manifest.xml
===================================================================
--- manifest.xml	(revision 5095)
+++ manifest.xml	(working copy)
@@ -2,18 +2,19 @@
 <CodeBlocks_plugin_manifest_file>
     <SdkVersion major="1" minor="10" release="0" />
     <Plugin name="DevPakUpdater">
-        <Value title="Dev-C++ DevPak updater/installer" />
-        <Value version="0.1" />
+        <Value title="DevPak updater/installer" />
+        <Value version="0.2" />
         <Value description="Installs selected DevPaks from the Internet" />
         <Value author="Yiannis Mandravellos" />
         <Value authorEmail="info@codeblocks.org" />
         <Value authorWebsite="http://www.codeblocks.org/" />
         <Value thanksTo="Dev-C++ community.
-                         Julian R Seward for libbzip2.
-                         libbzip2 copyright notice:
-                         bzip2 and associated library libbzip2, are
-                         copyright (C) 1996-2000 Julian R Seward.
-                         All rights reserved." />
+        Julian R Seward for libbzip2.
+
+        libbzip2 copyright notice:
+        bzip2 and associated library libbzip2, are
+        copyright (C) 1996-2000 Julian R Seward.
+        All rights reserved." />
         <Value license="GPL" />
     </Plugin>
 </CodeBlocks_plugin_manifest_file>
Index: conf.cpp
===================================================================
--- conf.cpp	(revision 5095)
+++ conf.cpp	(working copy)
@@ -46,10 +46,16 @@
     	// fix title
     	// devpaks.org has changed the title to contain some extra info
         // e.g.: [libunicows   Library version: 1.1.1   Devpak revision: 1sid]
-    	// we don't need this extra info, so if we find it we remove it
-    	int pos = rec.title.Find(_T("Library version:"));
+    	int pos = rec.title.Lower().Find(_T("library version:"));
     	if (pos != -1)
     	{
+            int revpos = rec.title.Lower().Find(_T("devpak revision:"));
+            if (revpos != -1) {
+                rec.revision = rec.title.Mid(revpos).AfterFirst(_T(':')).Trim(false);
+                rec.revision.Replace(_T("\t"), _T(" "));
+                rec.revision = rec.revision.BeforeFirst(_T(' '));
+            }
+
     		rec.title.Truncate(pos);
     		rec.title = rec.title.Trim(false);
     		rec.title = rec.title.Trim(true);
@@ -60,7 +66,7 @@
     	rec.remote_file = ini.GetKeyValue(i, _T("RemoteFilename"));
     	rec.local_file = ini.GetKeyValue(i, _T("LocalFilename"));
     	rec.groups = GetArrayFromString(ini.GetKeyValue(i, _T("Group")), _T(","));
-    	rec.install = ini.GetKeyValue(i, _T("InstallPath"));
+    	rec.install_path = ini.GetKeyValue(i, _T("InstallPath"));
     	rec.version = ini.GetKeyValue(i, _T("Version"));
         ini.GetKeyValue(i, _T("Size")).ToLong(&rec.bytes);
     	rec.date = ini.GetKeyValue(i, _T("Date"));
@@ -99,12 +105,17 @@
     return list;
 }
 
-UpdateRec* FindRecByTitle(const wxString& title, UpdateRec* list, int count)
+UpdateRec* FindRec(const wxString& title, const wxString& version, const wxString& revision, UpdateRec* list, int count)
 {
     for (int i = 0; i < count; ++i)
     {
-        if (list[i].title == title)
-            return &list[i];
+        if (list[i].title == title && list[i].version == version) {
+            if (revision.IsEmpty()) {
+                return &list[i];
+            } else if (list[i].revision == revision) {
+                    return &list[i];
+            }
+        }
     }
     return 0;
 }
Index: conf.h
===================================================================
--- conf.h	(revision 5095)
+++ conf.h	(working copy)
@@ -7,7 +7,7 @@
 
 struct UpdateRec
 {
-    wxString entry;
+    wxString entry;         //! .entry filename for installed
     wxString title;
     wxString name;
     wxString desc;
@@ -15,8 +15,9 @@
     wxString remote_file;
     wxString local_file;
     wxArrayString groups;
-    wxString install;
+    wxString install_path;  //! ignored
     wxString version;
+    wxString revision;
     wxString installed_version;
     long int bytes;
     float kilobytes;
@@ -31,7 +32,7 @@
 extern wxString g_MasterPath;
 
 UpdateRec* ReadConf(const IniParser& ini, int* recCount, const wxString& currentServer, const wxString& appPath);
-UpdateRec* FindRecByTitle(const wxString& title, UpdateRec* list, int count);
+UpdateRec* FindRec(const wxString& title, const wxString& version, const wxString& revision, UpdateRec* list, int count);
 // utility
 wxString GetSizeString(int bytes);