2 * abby Copyright (C) 2009 Toni Gundogdu.
3 * This file is part of abby.
5 * abby is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * abby is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <QInputDialog>
22 #include "feedmgrdlg.h"
24 FeedMgrDialog::FeedMgrDialog(QWidget
*parent
)
32 FeedMgrDialog::onAdd() {
33 QString lnk
= QInputDialog::getText(this,
34 tr("Add new RSS feed link"), tr("Enter link:"));
41 if (!lnk
.startsWith("http://",Qt::CaseInsensitive
))
42 lnk
.insert(0,"http://");
44 QList
<QListWidgetItem
*> found
45 = feedsList
->findItems(lnk
, Qt::MatchExactly
);
47 if (found
.size() == 0)
48 feedsList
->addItem(lnk
);
52 FeedMgrDialog::onRemove() {
53 QList
<QListWidgetItem
*> sel
= feedsList
->selectedItems();
54 for (register int i
=0; i
<sel
.size(); ++i
) {
55 const int row
= feedsList
->row(sel
[i
]);
56 delete feedsList
->takeItem(row
);
61 FeedMgrDialog::writeSettings() {
64 s
.beginGroup("FeedMgrDialog");
65 s
.setValue("size", size());
67 s
.beginWriteArray("feeds");
68 for (register int i
=0; i
<feedsList
->count(); ++i
) {
70 QListWidgetItem
*item
= feedsList
->item(i
);
71 s
.setValue("link",item
->text());
79 FeedMgrDialog::readSettings() {
82 s
.beginGroup("FeedMgrDialog");
83 resize( s
.value("size", QSize(505,255)).toSize() );
84 const int size
= s
.beginReadArray("feeds");
85 for (register int i
=0; i
<size
; ++i
) {
87 feedsList
->addItem(s
.value("link").toString());