Patch #2506 2008-06-27 08:33

techtonik

Patch for #14098
Download
2506-Patch_for_1409.patch (7.2 KB)
Category
Plugin::Bugfix
Status
Accepted
Close date
2008-07-18 15:49
Assigned to
mortenmacfly
Index: src/plugins/contrib/devpak_plugin/updatedlg.cpp
===================================================================
--- src/plugins/contrib/devpak_plugin/updatedlg.cpp    (revision 5106)
+++ src/plugins/contrib/devpak_plugin/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: src/plugins/contrib/devpak_plugin/updatedlg.h
===================================================================
--- src/plugins/contrib/devpak_plugin/updatedlg.h    (revision 5106)
+++ src/plugins/contrib/devpak_plugin/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: src/plugins/contrib/devpak_plugin/manifest.xml
===================================================================
--- src/plugins/contrib/devpak_plugin/manifest.xml    (revision 5106)
+++ src/plugins/contrib/devpak_plugin/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: src/plugins/contrib/devpak_plugin/conf.cpp
===================================================================
--- src/plugins/contrib/devpak_plugin/conf.cpp    (revision 5106)
+++ src/plugins/contrib/devpak_plugin/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(' '));
download for full patch...