Permalink
Browse files

Sorting columns, Settings dialog info

Plugin config path and status of appdata plugins now shown in settings dialog.
Sorting by clicking the column header now possible.
Defaults changed so if appdata plugins is switched on (after previously disabled), the default is to install per user.
  • Loading branch information...
1 parent 77b53a7 commit f4bbefbc4f86c471f7f5c129febf7768da10e420 @bruderstein committed Dec 4, 2011
View
20 pluginManager/src/PluginList.cpp
@@ -832,7 +832,15 @@ void PluginList::downloadList()
string serverMD5;
#ifdef ALLOW_OVERRIDE_XML_URL
- BOOL downloadResult = downloadManager.getUrl(g_options.downloadMD5Url.c_str(), serverMD5, &g_options.proxyInfo, &g_options.moduleInfo);
+ BOOL downloadResult;
+ if (!g_options.downloadMD5Url.empty())
+ {
+ downloadResult = downloadManager.getUrl(g_options.downloadMD5Url.c_str(), serverMD5, &g_options.proxyInfo, &g_options.moduleInfo);
+ }
+ else
+ {
+ downloadResult = downloadManager.getUrl(PLUGINS_MD5_URL, serverMD5, &g_options.proxyInfo, &g_options.moduleInfo);
+ }
#else
BOOL downloadResult = downloadManager.getUrl(PLUGINS_MD5_URL, serverMD5, &g_options.proxyInfo, &g_options.moduleInfo);
#endif
@@ -846,15 +854,21 @@ void PluginList::downloadList()
// Also, don't unzip it - assume if it's overridden, it's a test version and hence easier to treat it
// as a plain xml file
#ifdef ALLOW_OVERRIDE_XML_URL
+ if (!g_options.downloadUrl.empty())
+ {
downloadManager.getUrl(g_options.downloadUrl.c_str(), pluginsListFilename, contentType, &g_options.proxyInfo, &g_options.moduleInfo);
-#else
+ }
+ else
+#endif
+ {
downloadManager.getUrl(PLUGINS_URL, pluginsListZipFilename, contentType, &g_options.proxyInfo, &g_options.moduleInfo);
// Unzip the plugins.zip to PluginManagerPlugins.xml
tstring unzipPath(pluginConfig);
unzipPath.append(_T("\\"));
Decompress::unzip(pluginsListZipFilename, unzipPath);
-#endif
+ }
+
}
View
108 pluginManager/src/PluginListView.cpp
@@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "precompiled_headers.h"
#include "PluginListView.h"
#include "PluginList.h"
-
+#include "PluginVersion.h"
using namespace std;
@@ -101,6 +101,50 @@ LRESULT PluginListView::notify(WPARAM /*wParam*/, LPARAM lParam)
break;
}
+ case LVN_COLUMNCLICK:
+ {
+ NMLISTVIEW *colInfo = reinterpret_cast<NMLISTVIEW*>(lParam);
+ int (CALLBACK *compareFunc)(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) = NULL;
+ LVSORTCOLUMN sortColumn = LVSORTCOLUMN_NAME;
+
+ if (colInfo->iSubItem < 2 || colInfo->iSubItem == _nVersionColumns + 2)
+ {
+ compareFunc = PluginListView::stringComparer;
+
+ if (colInfo->iSubItem == 1)
+ {
+ sortColumn = LVSORTCOLUMN_CATEGORY;
+ }
+ else if (colInfo->iSubItem == _nVersionColumns + 2)
+ {
+ sortColumn = LVSORTCOLUMN_STABILITY;
+ }
+ }
+ else
+ {
+ compareFunc = PluginListView::versionComparer;
+
+ switch(_columns[colInfo->iSubItem - 2])
+ {
+ case VERSION_AVAILABLE:
+ sortColumn = LVSORTCOLUMN_VERSIONAVAILABLE;
+ break;
+
+ case VERSION_INSTALLED:
+ sortColumn = LVSORTCOLUMN_VERSIONINSTALLED;
+ break;
+
+ // Just in case there's another one introduced at some point (beta version or something)
+ default:
+ sortColumn = LVSORTCOLUMN_VERSIONAVAILABLE;
+ break;
+ }
+ }
+
+ ListView_SortItems(_hListView, compareFunc, static_cast<LPARAM>(sortColumn));
+ }
+ break;
+
case NM_CLICK:
if (_hDescription && lParam)
{
@@ -214,7 +258,7 @@ void PluginListView::setList(PluginListContainer &list)
++iter;
}
- ListView_SortItems(_hListView, PluginListView::itemComparer, NULL);
+ ListView_SortItems(_hListView, PluginListView::stringComparer, LVSORTCOLUMN_NAME);
}
@@ -334,7 +378,63 @@ BOOL PluginListView::empty()
return (ListView_GetItemCount(_hListView) == 0);
}
-int CALLBACK PluginListView::itemComparer(LPARAM lParam1, LPARAM lParam2, LPARAM /*lParamSort*/)
+int CALLBACK PluginListView::stringComparer(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
- return _tcscmp(reinterpret_cast<Plugin*>(lParam1)->getName().c_str(), reinterpret_cast<Plugin*>(lParam2)->getName().c_str());
+ const TCHAR *text1;
+ const TCHAR *text2;
+
+ switch(static_cast<LVSORTCOLUMN>(lParamSort))
+ {
+ case LVSORTCOLUMN_NAME:
+ text1 = reinterpret_cast<Plugin*>(lParam1)->getName().c_str();
+ text2 = reinterpret_cast<Plugin*>(lParam2)->getName().c_str();
+ break;
+
+ case LVSORTCOLUMN_STABILITY:
+ text1 = reinterpret_cast<Plugin*>(lParam1)->getStability().c_str();
+ text2 = reinterpret_cast<Plugin*>(lParam2)->getStability().c_str();
+ break;
+
+ case LVSORTCOLUMN_CATEGORY:
+ text1 = reinterpret_cast<Plugin*>(lParam1)->getCategory().c_str();
+ text2 = reinterpret_cast<Plugin*>(lParam2)->getCategory().c_str();
+ break;
+
+ default:
+ text1 = _T("");
+ text2 = _T("");
+ break;
+ }
+
+
+ return _tcsicmp(text1, text2);
+}
+
+
+int CALLBACK PluginListView::versionComparer(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
+{
+ PluginVersion version1, version2;
+
+ switch(static_cast<LVSORTCOLUMN>(lParamSort))
+ {
+ case LVSORTCOLUMN_VERSIONAVAILABLE:
+ version1 = reinterpret_cast<Plugin*>(lParam1)->getVersion();
+ version2 = reinterpret_cast<Plugin*>(lParam2)->getVersion();
+ break;
+
+ case LVSORTCOLUMN_VERSIONINSTALLED:
+ version1 = reinterpret_cast<Plugin*>(lParam1)->getInstalledVersion();
+ version2 = reinterpret_cast<Plugin*>(lParam2)->getInstalledVersion();
+ break;
+
+ }
+
+ int retVal = 0;
+
+ if (version1 < version2)
+ retVal = -1;
+ else if (version1 > version2)
+ retVal = 1;
+
+ return retVal;
}
View
13 pluginManager/src/PluginListView.h
@@ -75,7 +75,18 @@ class PluginListView
void initColumns(void);
int getCurrentSelectedIndex();
void setAllCheckState(BOOL checked);
- static int CALLBACK itemComparer(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+
+ enum LVSORTCOLUMN
+ {
+ LVSORTCOLUMN_NAME,
+ LVSORTCOLUMN_VERSIONAVAILABLE,
+ LVSORTCOLUMN_VERSIONINSTALLED,
+ LVSORTCOLUMN_CATEGORY,
+ LVSORTCOLUMN_STABILITY
+ };
+
+ static int CALLBACK stringComparer(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+ static int CALLBACK versionComparer(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
};
View
10 pluginManager/src/PluginManager.cpp
@@ -272,6 +272,12 @@ void loadSettings(void)
g_options.installLocation = INSTALLLOC_ALLUSERSNOAPPDATA;
}
}
+ // Else, if we've "upgraded" to support for all users, assume we want appdata plugins
+ else if (TRUE == g_options.appDataPluginsSupported
+ && g_options.installLocation == INSTALLLOC_ALLUSERSNOAPPDATA)
+ {
+ g_options.installLocation = INSTALLLOC_APPDATA;
+ }
TCHAR tmpLastCheck[20];
::GetPrivateProfileString(SETTINGS_GROUP, KEY_LASTCHECK, _T("0"), tmpLastCheck, 20, iniFilePath);
@@ -280,10 +286,10 @@ void loadSettings(void)
#ifdef ALLOW_OVERRIDE_XML_URL
TCHAR tmpUrl[MAX_PATH];
- ::GetPrivateProfileString(SETTINGS_GROUP, KEY_OVERRIDEMD5URL, PLUGINS_MD5_URL, tmpUrl, MAX_PATH, iniFilePath);
+ ::GetPrivateProfileString(SETTINGS_GROUP, KEY_OVERRIDEMD5URL, _T(""), tmpUrl, MAX_PATH, iniFilePath);
g_options.downloadMD5Url = tmpUrl;
- ::GetPrivateProfileString(SETTINGS_GROUP, KEY_OVERRIDEURL, PLUGINS_URL, tmpUrl, MAX_PATH, iniFilePath);
+ ::GetPrivateProfileString(SETTINGS_GROUP, KEY_OVERRIDEURL, _T(""), tmpUrl, MAX_PATH, iniFilePath);
g_options.downloadUrl = tmpUrl;
#endif
View
19 pluginManager/src/PluginManager.rc
@@ -62,24 +62,26 @@ BEGIN
LTEXT "Overall Progress:",IDC_STATIC,7,64,56,8
END
-IDD_CONFIGDIALOG DIALOGEX 0, 0, 266, 154
+IDD_CONFIGDIALOG DIALOGEX 0, 0, 293, 228
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Plugin Manager Settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "OK",IDOK,74,127,63,14
- PUSHBUTTON "Cancel",IDCANCEL,154,127,63,14
EDITTEXT IDC_PROXYADDRESS,59,7,200,14,ES_AUTOHSCROLL
EDITTEXT IDC_PROXYPORT,59,30,40,14,ES_AUTOHSCROLL
- LTEXT "Proxy address:",IDC_STATIC,7,9,50,8
- LTEXT "Proxy port:",IDC_STATIC,7,34,38,8
CONTROL "Notify of plugin updates at startup",IDC_NOTIFY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,59,54,127,10
+ LTEXT "Check for plugin updates every ",IDC_STATIC,59,68,103,8
+ EDITTEXT IDC_DAYSTOCHECK,164,65,20,14,ES_AUTOHSCROLL
CONTROL "Show unstable plugins",IDC_SHOWUNSTABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,60,92,87,10
CONTROL "Install plugins for all users",IDC_INSTALLALLUSERS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,60,109,99,10
- LTEXT "Check for plugin updates every ",IDC_STATIC,59,68,103,8
- EDITTEXT IDC_DAYSTOCHECK,164,65,20,14,ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,71,204,63,14
+ PUSHBUTTON "Cancel",IDCANCEL,151,204,63,14
+ LTEXT "Proxy address:",IDC_STATIC,7,9,50,8
+ LTEXT "Proxy port:",IDC_STATIC,7,34,38,8
LTEXT "days",IDC_STATIC,189,68,69,8
+ GROUPBOX "Information",IDC_STATIC,12,129,278,72
+ EDITTEXT IDC_INFOTEXT,19,142,264,51,ES_MULTILINE | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
END
IDD_UPDATESNOTIFY DIALOGEX 0, 0, 402, 164
@@ -106,7 +108,8 @@ GUIDELINES DESIGNINFO
BEGIN
IDD_CONFIGDIALOG, DIALOG
BEGIN
- BOTTOMMARGIN, 136
+ RIGHTMARGIN, 290
+ BOTTOMMARGIN, 218
END
END
#endif // APSTUDIO_INVOKED
View
6 pluginManager/src/PluginManagerVersion.h
@@ -1,9 +1,9 @@
#ifndef _PLUGINMANAGERVERSION_H
#define _PLUGINMANAGERVERSION_H
-#define PLUGINMANAGERVERSION_STRING "1.0.1.0"
-#define PLUGINMANAGERVERSION_RESOURCE 1,0,1,0
-#define PLUGINMANAGERVERSION_RESOURCE_STRING "1, 0, 1, 0"
+#define PLUGINMANAGERVERSION_STRING "1.0.2.0"
+#define PLUGINMANAGERVERSION_RESOURCE 1,0,2,0
+#define PLUGINMANAGERVERSION_RESOURCE_STRING "1, 0, 2, 0"
#define PLUGINMANAGERVERSION_RELEASEDATE "December 2011"
#endif
View
21 pluginManager/src/SettingsDialog.cpp
@@ -23,8 +23,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "SettingsDialog.h"
#include "resource.h"
-void SettingsDialog::doModal(HWND parent)
+void SettingsDialog::doModal(NppData *nppData, HWND parent)
{
+ _nppData = nppData;
::DialogBoxParam((HINSTANCE)g_hModule, MAKEINTRESOURCE(IDD_CONFIGDIALOG), parent, SettingsDialog::dlgProc, reinterpret_cast<LPARAM>(this));
}
@@ -106,6 +107,24 @@ void SettingsDialog::initialiseOptions()
::SendMessage(GetDlgItem(_hSelf, IDC_INSTALLALLUSERS), BM_SETCHECK, g_options.installLocation == INSTALLLOC_APPDATA ? BST_UNCHECKED : BST_CHECKED, 0);
::EnableWindow(GetDlgItem(_hSelf, IDC_INSTALLALLUSERS), g_options.appDataPluginsSupported);
+
+ tstring info(_T("Plugin Config path is:\r\n"));
+ TCHAR path[MAX_PATH];
+ path[0] = _T('\0');
+ ::SendMessage(_nppData->_nppHandle, NPPM_GETPLUGINSCONFIGDIR, MAX_PATH, reinterpret_cast<LPARAM>(path));
+ info.append(path);
+ info.append(_T("\r\n"));
+ if (g_options.appDataPluginsSupported)
+ {
+ info.append(_T("Plugins in user's AppData directory are enabled. Remove the allowAppDataPlugins.xml file from the Notepad++ directory to disable."));
+ }
+ else
+ {
+ info.append(_T("Plugins in user's AppData directory are disabled - to enable in Notepad++ version 5.9.7 onwards place an empty file called allowAppDataPlugins.xml in the Notepad++ directory."));
+ }
+
+ SetWindowText(GetDlgItem(_hSelf, IDC_INFOTEXT), info.c_str());
+
}
void SettingsDialog::setOptions()
View
5 pluginManager/src/SettingsDialog.h
@@ -1,6 +1,7 @@
#ifndef _SETTINGSDIALOG_H
#define _SETTINGSDIALOG_H
+struct NppData;
@@ -11,7 +12,7 @@ class SettingsDialog
SettingsDialog() {};
~SettingsDialog() {};
- void doModal(HWND parent);
+ void doModal(NppData *nppData, HWND parent);
@@ -26,7 +27,7 @@ protected :
void initialiseOptions();
void setOptions();
-
+ NppData *_nppData;
HWND _hSelf;
};
View
2 pluginManager/src/pluginmanagerdialog.cpp
@@ -438,7 +438,7 @@ BOOL CALLBACK PluginManagerDialog::run_dlgProc(HWND hWnd, UINT Message, WPARAM w
std::string oldProxy (g_options.proxyInfo.getProxy());
int oldProxyPort = g_options.proxyInfo.getProxyPort();
- settingsDlg.doModal(_hSelf);
+ settingsDlg.doModal(&_nppData, _hSelf);
std::string newProxy (g_options.proxyInfo.getProxy());
if (oldProxyPort != g_options.proxyInfo.getProxyPort()
View
3 pluginManager/src/resource.h
@@ -39,14 +39,15 @@
#define IDC_BUTTON2 1022
#define IDC_UPDATEDESC 1023
#define IDC_DAYSTOCHECK 1024
+#define IDC_INFOTEXT 1026
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 116
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1025
+#define _APS_NEXT_CONTROL_VALUE 1027
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

0 comments on commit f4bbefb

Please sign in to comment.