diff options
author | George Hazan <george.hazan@gmail.com> | 2012-08-04 20:56:21 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-08-04 20:56:21 +0000 |
commit | 6a992c3cc581b000faa5b8615b5b84865b4c31c4 (patch) | |
tree | 119696da78005b6c963f9a506f1e90478ca0c08a /plugins/PluginUpdater/src/Scanner.cpp | |
parent | eb9c3053eb919108153582909ab80e3b42462994 (diff) |
modeless dialog
git-svn-id: http://svn.miranda-ng.org/main/trunk@1360 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater/src/Scanner.cpp')
-rw-r--r-- | plugins/PluginUpdater/src/Scanner.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/plugins/PluginUpdater/src/Scanner.cpp b/plugins/PluginUpdater/src/Scanner.cpp index 9aea8b20a0..fd6a035174 100644 --- a/plugins/PluginUpdater/src/Scanner.cpp +++ b/plugins/PluginUpdater/src/Scanner.cpp @@ -36,7 +36,7 @@ static bool Exists(LPCTSTR strName) typedef map<string, string> hashMap;
typedef pair<string, string> hashItem;
-static void ScanFolder(const TCHAR* tszFolder, const TCHAR* tszBaseUrl, hashMap& hashes, vector<FILEINFO>& UpdateFiles)
+static void ScanFolder(const TCHAR* tszFolder, const TCHAR* tszBaseUrl, hashMap& hashes, vector<FILEINFO>* UpdateFiles)
{
TCHAR tszMask[MAX_PATH], tszFileBack[MAX_PATH];
mir_sntprintf(tszMask, SIZEOF(tszMask), _T("%s\\*"), tszFolder);
@@ -102,7 +102,7 @@ static void ScanFolder(const TCHAR* tszFolder, const TCHAR* tszBaseUrl, hashMap& mir_sntprintf(FileInfo.File.tszDiskPath, SIZEOF(FileInfo.File.tszDiskPath), _T("%s\\%s.zip"), tszFileBack, ffd.cFileName);
- UpdateFiles.push_back(FileInfo);
+ UpdateFiles->push_back(FileInfo);
} // end compare versions
}
while (FindNextFile(hFind, &ffd) != 0);
@@ -110,13 +110,16 @@ static void ScanFolder(const TCHAR* tszFolder, const TCHAR* tszBaseUrl, hashMap& FindClose(hFind);
}
+static void __stdcall LaunchDialog(void* param)
+{
+ DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_UPDATE), GetDesktopWindow(), DlgUpdate, (LPARAM)param);
+}
+
static void CheckUpdates(void *)
{
TCHAR tszBuff[2048] = {0}, /*tszFileInfo[30] = {0},*/ tszTmpIni[MAX_PATH] = {0};
char szKey[64] = {0};
- INT upd_ret;
DBVARIANT dbVar = {0};
- vector<FILEINFO> UpdateFiles;
if (!Exists(tszRoot))
CreateDirectoryTreeT(tszRoot);
@@ -168,27 +171,24 @@ static void CheckUpdates(void *) fclose(fp);
DeleteFile(tszTmpIni);
+ vector<FILEINFO>* UpdateFiles = new vector<FILEINFO>;
TCHAR *dirname = Utils_ReplaceVarsT(_T("%miranda_path%"));
ScanFolder(dirname, tszBaseUrl, hashes, UpdateFiles);
mir_free(dirname);
// Show dialog
- if (UpdateFiles.size() > 0)
- upd_ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_UPDATE), GetDesktopWindow(), DlgUpdate, (LPARAM)&UpdateFiles);
- if (upd_ret == IDCANCEL) {
- CheckThread = NULL;
- return;
+ if (UpdateFiles->size() == 0) {
+ if ( !Silent)
+ ShowPopup(0, LPGENT("Plugin Updater"), LPGENT("No updates found."), 2, 0);
}
-
- if (!UpdateFiles.size() && !Silent)
- ShowPopup(0, LPGENT("Plugin Updater"), LPGENT("No updates found."), 2, 0);
+ else CallFunctionAsync(LaunchDialog, UpdateFiles);
CheckThread = NULL;
}
-void DoCheck(int iFlag, int iFlag2)
+void DoCheck(int iFlag)
{
- if (iFlag2)
+ if (CheckThread || hwndDialog)
ShowPopup(0, LPGENT("Plugin Updater"), LPGENT("Update checking already started!"), 2, 0);
else if (iFlag) {
CheckThread = mir_forkthread(CheckUpdates, 0);
|