From f8f7f8976a4c05afb34e6b4a89116d244ce73d5f Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 21 Jul 2013 09:04:03 +0000 Subject: added items for moving all feeds git-svn-id: http://svn.miranda-ng.org/main/trunk@5438 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewsAggregator/Res/Resource.rc | 33 +++++++++------- plugins/NewsAggregator/Src/ExportImport.cpp | 61 ++++++++++++++++++++++++++--- plugins/NewsAggregator/Src/resource.h | 3 +- 3 files changed, 76 insertions(+), 21 deletions(-) (limited to 'plugins') diff --git a/plugins/NewsAggregator/Res/Resource.rc b/plugins/NewsAggregator/Res/Resource.rc index bc2b977d46..7cea0b83f8 100644 --- a/plugins/NewsAggregator/Res/Resource.rc +++ b/plugins/NewsAggregator/Res/Resource.rc @@ -111,30 +111,33 @@ BEGIN LTEXT "Feeds to be exported:",IDC_STATIC,150,6,98,8 LISTBOX IDC_FEEDSLIST,6,18,120,98,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP LISTBOX IDC_FEEDSEXPORTLIST,150,18,120,98,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP - PUSHBUTTON "->",IDC_ADDFEED,129,50,17,14 - PUSHBUTTON "<-",IDC_REMOVEFEED,129,66,17,14 + PUSHBUTTON "->",IDC_ADDFEED,129,24,17,14 + PUSHBUTTON "<-",IDC_REMOVEFEED,129,40,17,14 PUSHBUTTON "&Export",IDOK,164,120,50,14 PUSHBUTTON "&Close",IDCANCEL,220,120,50,14 + PUSHBUTTON "->>",IDC_ADDALLFEEDS,129,78,17,14 + PUSHBUTTON "<<-",IDC_REMOVEALLFEEDS,129,95,17,14 END -IDD_FEEDIMPORT DIALOGEX 0, 0, 276, 183 +IDD_FEEDIMPORT DIALOGEX 0, 0, 276, 161 STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES | WS_EX_CONTROLPARENT CAPTION "Import" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - LTEXT "Import from:",IDC_STATIC,6,9,47,8 - EDITTEXT IDC_IMPORTFILEPATH,59,7,186,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES - PUSHBUTTON "...",IDC_BROWSEIMPORTFILE,248,7,22,14 - PUSHBUTTON "Load",IDC_LOADIMPORTFILE,112,26,50,14 - LTEXT "Available feeds:",IDC_STATIC,6,50,100,8 - LTEXT "Feeds to be imported:",IDC_STATIC,150,50,101,8 - LISTBOX IDC_FEEDSLIST,6,62,120,98,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP - LISTBOX IDC_FEEDSIMPORTLIST,150,62,120,98,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP - PUSHBUTTON "->",IDC_ADDFEED,129,94,17,14 - PUSHBUTTON "<-",IDC_REMOVEFEED,129,110,17,14 - PUSHBUTTON "&Import",IDOK,165,165,50,14 - PUSHBUTTON "&Close",IDCANCEL,220,165,50,14 + LTEXT "Import from:",IDC_STATIC,6,7,47,8 + EDITTEXT IDC_IMPORTFILEPATH,59,5,186,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES + PUSHBUTTON "...",IDC_BROWSEIMPORTFILE,248,5,22,14 + LTEXT "Available feeds:",IDC_STATIC,6,26,100,8 + LTEXT "Feeds to be imported:",IDC_STATIC,150,26,101,8 + LISTBOX IDC_FEEDSLIST,6,38,120,98,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP + LISTBOX IDC_FEEDSIMPORTLIST,150,38,120,98,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP + PUSHBUTTON "->",IDC_ADDFEED,129,47,17,14 + PUSHBUTTON "<-",IDC_REMOVEFEED,129,63,17,14 + PUSHBUTTON "&Import",IDOK,165,141,50,14 + PUSHBUTTON "&Close",IDCANCEL,220,141,50,14 + PUSHBUTTON "->>",IDC_ADDALLFEEDS,129,97,17,14 + PUSHBUTTON "<<-",IDC_REMOVEALLFEEDS,129,113,17,14 END diff --git a/plugins/NewsAggregator/Src/ExportImport.cpp b/plugins/NewsAggregator/Src/ExportImport.cpp index 1a1344fc58..3aadc4f22f 100644 --- a/plugins/NewsAggregator/Src/ExportImport.cpp +++ b/plugins/NewsAggregator/Src/ExportImport.cpp @@ -242,9 +242,12 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } } EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE); - if (!SendMessage(FeedsList, LB_GETCOUNT, 0, 0)) + if (!SendMessage(FeedsList, LB_GETCOUNT, 0, 0)) { EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), FALSE); + } return TRUE; case WM_COMMAND: @@ -340,8 +343,10 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_ADDFEED: { - if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEFEED))) + if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEFEED))) EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), TRUE); + if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS))) + EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), TRUE); if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE); int cursel = SendMessage(FeedsList, LB_GETCURSEL, 0, 0); @@ -349,27 +354,73 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SendMessage(FeedsList, LB_GETTEXT, cursel, (LPARAM)item); SendMessage(FeedsExportList, LB_ADDSTRING, 0, (LPARAM)item); SendMessage(FeedsList, LB_DELETESTRING, cursel, 0); - if (!SendMessage(FeedsList, LB_GETCOUNT, 0, 0)) + if (!SendMessage(FeedsList, LB_GETCOUNT, 0, 0)) { EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), FALSE); + } } break; case IDC_REMOVEFEED: { + if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDFEED))) + EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), TRUE); + if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS))) + EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE); int cursel = SendMessage(FeedsExportList, LB_GETCURSEL, 0, 0); TCHAR item[MAX_PATH]; SendMessage(FeedsExportList, LB_GETTEXT, cursel, (LPARAM)item); - if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDFEED))) - EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), TRUE); SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)item); SendMessage(FeedsExportList, LB_DELETESTRING, cursel, 0); if (!SendMessage(FeedsExportList, LB_GETCOUNT, 0, 0)) { EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE); } } break; + + case IDC_ADDALLFEEDS: + { + if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEFEED))) + EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), TRUE); + if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS))) + EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), TRUE); + if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) + EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE); + int count = SendMessage(FeedsList, LB_GETCOUNT, 0, 0); + for (int i = 0; i < count; i++) { + TCHAR item[MAX_PATH]; + SendMessage(FeedsList, LB_GETTEXT, i, (LPARAM)item); + SendMessage(FeedsExportList, LB_ADDSTRING, 0, (LPARAM)item); + } + for (int i = count - 1; i > -1; i--) + SendMessage(FeedsList, LB_DELETESTRING, i, 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), FALSE); + } + break; + + case IDC_REMOVEALLFEEDS: + { + if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDFEED))) + EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), TRUE); + if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS))) + EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE); + int count = SendMessage(FeedsExportList, LB_GETCOUNT, 0, 0); + for (int i = 0; i < count; i++) { + TCHAR item[MAX_PATH]; + SendMessage(FeedsExportList, LB_GETTEXT, i, (LPARAM)item); + SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)item); + } + for (int i = count - 1; i > -1; i--) + SendMessage(FeedsExportList, LB_DELETESTRING, i, 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE); + } + break; } break; diff --git a/plugins/NewsAggregator/Src/resource.h b/plugins/NewsAggregator/Src/resource.h index e45b33deeb..9d682755e4 100644 --- a/plugins/NewsAggregator/Src/resource.h +++ b/plugins/NewsAggregator/Src/resource.h @@ -38,9 +38,10 @@ #define IDC_FEEDSEXPORTLIST 1109 #define IDC_ADDFEED 1110 #define IDC_REMOVEFEED 1111 +#define IDC_ADDALLFEEDS 1112 +#define IDC_REMOVEALLFEEDS 1113 #define IDC_IMPORTFILEPATH 1114 #define IDC_BROWSEIMPORTFILE 1115 -#define IDC_LOADIMPORTFILE 1116 #define IDC_FEEDSIMPORTLIST 1117 #define IDC_FEEDNAME 1124 -- cgit v1.2.3