summaryrefslogtreecommitdiff
path: root/plugins/NewsAggregator/Src/Options.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-06-20 19:19:42 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-06-20 19:19:42 +0000
commitfdc60f98786a6afb1667389366fe7b097a456e15 (patch)
tree03b25114c3fc24a575c1e8ffa0068e1f00b7c11e /plugins/NewsAggregator/Src/Options.cpp
parentac057302bf57012c40e3307e2fde6669f7c21322 (diff)
Export also added
git-svn-id: http://svn.miranda-ng.org/main/trunk@5071 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewsAggregator/Src/Options.cpp')
-rw-r--r--plugins/NewsAggregator/Src/Options.cpp80
1 files changed, 1 insertions, 79 deletions
diff --git a/plugins/NewsAggregator/Src/Options.cpp b/plugins/NewsAggregator/Src/Options.cpp
index 9144b68a85..6b6f4cfa15 100644
--- a/plugins/NewsAggregator/Src/Options.cpp
+++ b/plugins/NewsAggregator/Src/Options.cpp
@@ -518,85 +518,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
return FALSE;
case IDC_EXPORT:
- {
- TCHAR FileName[MAX_PATH];
- TCHAR *tszMirDir = Utils_ReplaceVarsT(_T("%miranda_path%"));
-
- OPENFILENAME ofn = {0};
- ofn.lStructSize = sizeof(ofn);
- TCHAR tmp[MAX_PATH];
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.opml)%c*.opml%c%c"), TranslateT("OPML files"), 0, 0, 0);
- ofn.lpstrFilter = tmp;
- ofn.hwndOwner = 0;
- ofn.lpstrFile = FileName;
- ofn.nMaxFile = MAX_PATH;
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.Flags = OFN_HIDEREADONLY | OFN_SHAREAWARE | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;
- ofn.lpstrInitialDir = tszMirDir;
- *FileName = '\0';
- ofn.lpstrDefExt = _T("");
-
- if (GetSaveFileName(&ofn)) {
- HXML hXml = xi.createNode(_T("opml"), NULL, FALSE);
- xi.addAttr(hXml, _T("version"), _T("1.0"));
- HXML header = xi.addChild(hXml, _T("head"), NULL);
- HXML title = xi.addChild(header, _T("title"), _T("Miranda NG NewsAggregator plugin export"));
- header = xi.addChild(hXml, _T("body"), NULL);
-
- for (HANDLE hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
- TCHAR *title = NULL, *url = NULL, *siteurl = NULL, *group = NULL;
- DBVARIANT dbv = {0};
- if (!db_get_ts(hContact, MODULE, "Nick", &dbv)) {
- title = mir_tstrdup(dbv.ptszVal);
- db_free(&dbv);
- }
- if (!db_get_ts(hContact, MODULE, "URL", &dbv)) {
- url = mir_tstrdup(dbv.ptszVal);
- db_free(&dbv);
- }
- if (!db_get_ts(hContact, MODULE, "Homepage", &dbv)) {
- siteurl = mir_tstrdup(dbv.ptszVal);
- db_free(&dbv);
- }
- if (!db_get_ts(hContact, "CList", "Group", &dbv)) {
- group = mir_tstrdup(dbv.ptszVal);
- db_free(&dbv);
- }
- HXML elem = header;
- if (group)
- {
- TCHAR *section = _tcstok(group, _T("\\"));
- while (section != NULL)
- {
- HXML existgroup = xi.getChildByAttrValue(header, _T("outline"), _T("title"), section);
- if ( !existgroup)
- {
- elem = xi.addChild(elem, _T("outline"), NULL);
- xi.addAttr(elem, _T("title"), section);
- xi.addAttr(elem, _T("text"), section);
- } else {
- elem = existgroup;
- }
- section = _tcstok(NULL, _T("\\"));
- }
- elem = xi.addChild(elem, _T("outline"), NULL);
- } else
- elem = xi.addChild(elem, _T("outline"), NULL);
- xi.addAttr(elem, _T("text"), title);
- xi.addAttr(elem, _T("title"), title);
- xi.addAttr(elem, _T("type"), _T("rss"));
- xi.addAttr(elem, _T("xmlUrl"), url);
- xi.addAttr(elem, _T("htmlUrl"), siteurl);
-
- mir_free(title);
- mir_free(url);
- mir_free(siteurl);
- mir_free(group);
- }
- xi.toFile(hXml, FileName, 1);
- xi.destroyNode(hXml);
- }
- }
+ ExportFeedsDialog();
return FALSE;
case IDC_STARTUPRETRIEVE: