Advertisement
Guest User

Untitled

a guest
Jun 12th, 2017
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 40.95 KB | None | 0 0
  1. diff --git a/kget/CMakeLists.txt b/kget/CMakeLists.txt
  2. index 3b2fae6..27e10a3 100644
  3. --- a/kget/CMakeLists.txt
  4. +++ b/kget/CMakeLists.txt
  5. @@ -169,6 +169,8 @@ install(TARGETS kgetcore ${INSTALL_TARGETS_DEFAULT_ARGS})
  6.  # kget
  7.  
  8.  set(kget_SRCS ${kget_adaptor_SRCS} ${kget_transfer_adaptor_SRCS}
  9. +   conf/autopastemodel.cpp
  10. +   conf/integrationpreferences.cpp
  11.     conf/dlgwebinterface.cpp
  12.     conf/preferencesdialog.cpp
  13.     conf/transfersgrouptree.cpp
  14. @@ -248,6 +250,7 @@ kde4_add_ui_files(kget_SRCS
  15.     conf/dlgadvanced.ui
  16.     conf/dlgappearance.ui
  17.     conf/dlggroups.ui
  18. +   conf/dlgintegration.ui
  19.     conf/dlgwebinterface.ui
  20.     conf/dlgnetwork.ui
  21.     conf/verificationpreferences.ui
  22. diff --git a/kget/conf/autopastemodel.cpp b/kget/conf/autopastemodel.cpp
  23. new file mode 100644
  24. index 0000000..833d5d0
  25. --- /dev/null
  26. +++ b/kget/conf/autopastemodel.cpp
  27. @@ -0,0 +1,340 @@
  28. +/***************************************************************************
  29. +*   Copyright (C) 2010 Matthias Fuchs <mat69@gmx.net>                     *
  30. +*                                                                         *
  31. +*   This program is free software; you can redistribute it and/or modify  *
  32. +*   it under the terms of the GNU General Public License as published by  *
  33. +*   the Free Software Foundation; either version 2 of the License, or     *
  34. +*   (at your option) any later version.                                   *
  35. +*                                                                         *
  36. +*   This program is distributed in the hope that it will be useful,       *
  37. +*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
  38. +*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
  39. +*   GNU General Public License for more details.                          *
  40. +*                                                                         *
  41. +*   You should have received a copy of the GNU General Public License     *
  42. +*   along with this program; if not, write to the                         *
  43. +*   Free Software Foundation, Inc.,                                       *
  44. +*   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
  45. +***************************************************************************/
  46. +
  47. +#include "autopastemodel.h"
  48. +#include "settings.h"
  49. +
  50. +#include <KComboBox>
  51. +#include <KIcon>
  52. +#include <KLineEdit>
  53. +#include <KLocale>
  54. +
  55. +AutoPasteDelegate::AutoPasteDelegate(QAbstractItemModel *types, QAbstractItemModel *syntaxes, QObject *parent)
  56. +  : QStyledItemDelegate(parent),
  57. +    m_types(types),
  58. +    m_syntaxes(syntaxes)
  59. +{
  60. +}
  61. +
  62. +QWidget *AutoPasteDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
  63. +{
  64. +    Q_UNUSED(option)
  65. +
  66. +    if (!index.isValid()) {
  67. +        return 0;
  68. +    }
  69. +
  70. +    switch(index.column()) {
  71. +        case AutoPasteModel::Type: {
  72. +            KComboBox *types = new KComboBox(parent);
  73. +            types->setModel(m_types);
  74. +            return types;
  75. +        }
  76. +        case AutoPasteModel::Pattern: {
  77. +            KLineEdit *pattern = new KLineEdit(parent);
  78. +            return pattern;
  79. +        }
  80. +        case AutoPasteModel::PatternSyntax: {
  81. +            KComboBox *syntaxes = new KComboBox(parent);
  82. +            syntaxes->setModel(m_syntaxes);
  83. +            return syntaxes;
  84. +        }
  85. +        default:
  86. +            return 0;
  87. +    }
  88. +}
  89. +
  90. +void AutoPasteDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
  91. +{
  92. +    if (!index.isValid() || !editor) {
  93. +        return;
  94. +    }
  95. +
  96. +    switch (index.column()) {
  97. +        case AutoPasteModel::Type: {
  98. +            KComboBox *type = static_cast<KComboBox*>(editor);
  99. +            const int row = type->findData(index.data(Qt::EditRole));
  100. +            type->setCurrentIndex(row);
  101. +            break;
  102. +        }
  103. +        case AutoPasteModel::Pattern: {
  104. +            KLineEdit *line = static_cast<KLineEdit*>(editor);
  105. +            line->setText(index.data(Qt::EditRole).toString());
  106. +            break;
  107. +        }
  108. +        case AutoPasteModel::PatternSyntax: {
  109. +            KComboBox *syntax = static_cast<KComboBox*>(editor);
  110. +            const int row = syntax->findData(index.data(Qt::EditRole));
  111. +            syntax->setCurrentIndex(row);
  112. +            break;
  113. +        }
  114. +        default:
  115. +            break;
  116. +    }
  117. +}
  118. +
  119. +void AutoPasteDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
  120. +{
  121. +    if (!index.isValid() || !editor || !model) {
  122. +        return;
  123. +    }
  124. +
  125. +    switch (index.column()) {
  126. +        case AutoPasteModel::Type: {
  127. +            KComboBox *typeBox = static_cast<KComboBox*>(editor);
  128. +            const int type = typeBox->itemData(typeBox->currentIndex()).toInt();
  129. +            model->setData(index, type);
  130. +            break;
  131. +        }
  132. +        case AutoPasteModel::Pattern: {
  133. +            KLineEdit *line = static_cast<KLineEdit*>(editor);
  134. +            const QString text = line->text();
  135. +            if (!text.isEmpty()) {
  136. +                model->setData(index, text);
  137. +            }
  138. +            break;
  139. +        }
  140. +        case AutoPasteModel::PatternSyntax: {
  141. +            KComboBox *syntaxBox = static_cast<KComboBox*>(editor);
  142. +            const int syntax = syntaxBox->itemData(syntaxBox->currentIndex()).toInt();
  143. +            model->setData(index, syntax);
  144. +            break;
  145. +        }
  146. +        default:
  147. +            break;
  148. +    }
  149. +}
  150. +//TODO needed??
  151. +void AutoPasteDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
  152. +{
  153. +    Q_UNUSED(index)
  154. +    editor->setGeometry(option.rect);
  155. +}
  156. +//TODO needed??
  157. +QSize AutoPasteDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
  158. +{
  159. +    //make the sizeHint a little bit nicer to have more beautiful editors
  160. +    QSize hint;
  161. +    hint.setWidth(QStyledItemDelegate::sizeHint(option, index).width());
  162. +    hint.setHeight(option.fontMetrics.height() + 7);
  163. +    return hint;
  164. +}
  165. +
  166. +AutoPasteModel::AutoPasteModel(QObject *parent)
  167. +  : QAbstractTableModel(parent)
  168. +{
  169. +}
  170. +
  171. +AutoPasteModel::~AutoPasteModel()
  172. +{
  173. +}
  174. +
  175. +int AutoPasteModel::rowCount(const QModelIndex &index) const
  176. +{
  177. +    if (!index.isValid()) {
  178. +        return m_data.count();
  179. +    }
  180. +
  181. +    return 0;
  182. +}
  183. +
  184. +int AutoPasteModel::columnCount(const QModelIndex &index) const
  185. +{
  186. +    if (!index.isValid()) {
  187. +        return 3;
  188. +    }
  189. +
  190. +    return 0;
  191. +}
  192. +
  193. +QVariant AutoPasteModel::headerData(int section, Qt::Orientation orientation, int role) const
  194. +{
  195. +    if (orientation == Qt::Vertical) {
  196. +        return QVariant();
  197. +    }
  198. +
  199. +    if (role == Qt::DisplayRole) {
  200. +        if (section == Pattern) {
  201. +            return i18n("Pattern");
  202. +        } else if (section == PatternSyntax) {
  203. +            return i18n("Syntax");
  204. +        }
  205. +    }
  206. +
  207. +    return QVariant();
  208. +}
  209. +
  210. +QVariant AutoPasteModel::data(const QModelIndex &index, int role) const
  211. +{
  212. +    if (!index.isValid()) {
  213. +        return QVariant();
  214. +    }
  215. +
  216. +    const int column = index.column();
  217. +    const int row = index.row();
  218. +
  219. +    if (column == Type) {
  220. +        if (role == Qt::DecorationRole) {
  221. +            return (m_data[row].type == Include ? KIcon("list-add") : KIcon("list-remove"));
  222. +        } else if ((role == Qt::UserRole) || (role == Qt::EditRole)) {
  223. +            return m_data[row].type;
  224. +        }
  225. +    } else if (column == Pattern) {
  226. +        if ((role == Qt::DisplayRole) || (role == Qt::EditRole) || (role == Qt::UserRole)) {
  227. +            return m_data[row].pattern;
  228. +        }
  229. +    } else if (column == PatternSyntax) {
  230. +        if (role == Qt::DisplayRole) {
  231. +            return (m_data[row].syntax == Wildcard ? i18n("Escape sequences") : i18n("Regular expression"));
  232. +        } else if ((role == Qt::UserRole) || (role == Qt::EditRole)) {
  233. +            return m_data[row].syntax;
  234. +        }
  235. +    }
  236. +
  237. +    return QVariant();
  238. +}
  239. +
  240. +Qt::ItemFlags AutoPasteModel::flags(const QModelIndex &index) const
  241. +{
  242. +    Q_UNUSED(index)
  243. +
  244. +    return (Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable);
  245. +}
  246. +
  247. +bool AutoPasteModel::setData(const QModelIndex &index, const QVariant &value, int role)
  248. +{
  249. +    const int row = index.row();
  250. +    const int column = index.column();
  251. +    bool changed = false;
  252. +
  253. +    if (role == Qt::EditRole) {
  254. +        if (column == Type) {
  255. +            m_data[row].type = static_cast<TypeData>(value.toInt());
  256. +            changed = true;
  257. +        } else if (column == Pattern) {
  258. +            m_data[row].pattern = value.toString();
  259. +            changed = true;
  260. +        } else if (column == PatternSyntax) {
  261. +            m_data[row].syntax = static_cast<PatternSyntaxData>(value.toInt());
  262. +            changed = true;
  263. +        }
  264. +    }
  265. +
  266. +    if (changed) {
  267. +        emit dataChanged(index, index);
  268. +    }
  269. +
  270. +    return changed;
  271. +}
  272. +
  273. +bool AutoPasteModel::removeRows(int row, int count, const QModelIndex &parent)
  274. +{
  275. +    if (parent.isValid() || (row < 0) || (count < 1) || (row + count > rowCount())) {
  276. +        return false;
  277. +    }
  278. +
  279. +    beginRemoveRows(parent, row, row + count - 1);
  280. +    while (count) {
  281. +        m_data.removeAt(row);
  282. +        --count;
  283. +    }
  284. +    endRemoveRows();
  285. +
  286. +    return true;
  287. +}
  288. +
  289. +void AutoPasteModel::addItem(TypeData dataType, PatternSyntaxData patternSyntax, const QString &pattern)
  290. +{
  291. +    addItems(QList<int>() << dataType, QList<int>() << patternSyntax, QStringList() << pattern);
  292. +}
  293. +
  294. +void AutoPasteModel::addItems(const QList<int> &dataTypes, const QList<int> patternSyntaxes, const QStringList &patterns)
  295. +{
  296. +    const int row = rowCount();
  297. +    const int numItems = patterns.count();
  298. +    beginInsertRows(QModelIndex(), row, row + numItems - 1);
  299. +
  300. +    for (int i = 0; i < numItems; ++i) {
  301. +        Data data;
  302. +        data.type = static_cast<TypeData>(dataTypes[i]);
  303. +        data.pattern = patterns[i];
  304. +        data.syntax = static_cast<PatternSyntaxData>(patternSyntaxes[i]);
  305. +        m_data.append(data);
  306. +    }
  307. +
  308. +    endInsertRows();
  309. +}
  310. +
  311. +bool AutoPasteModel::moveItem(int sourceRow, int destinationRow)
  312. +{
  313. +    if (!beginMoveRows(QModelIndex(), sourceRow, sourceRow, QModelIndex(), destinationRow)) {
  314. +        return false;
  315. +    }
  316. +
  317. +    //beginMoveRows asks for different data, than QList::move does, see the 4.7 docs
  318. +    if (sourceRow + 2 == destinationRow) {
  319. +        --destinationRow;
  320. +    }
  321. +    m_data.move(sourceRow, destinationRow);
  322. +    endMoveRows();
  323. +
  324. +    return true;
  325. +}
  326. +
  327. +void AutoPasteModel::load()
  328. +{
  329. +    //remove all old items if there are any
  330. +    if (rowCount()) {
  331. +        beginRemoveRows(QModelIndex(), 0, rowCount() - 1);
  332. +        m_data.clear();
  333. +        endRemoveRows();
  334. +    }
  335. +    addItems(Settings::autoPasteTypes(), Settings::autoPastePatternSyntaxes(), Settings::autoPastePatterns());
  336. +}
  337. +
  338. +void AutoPasteModel::save()
  339. +{
  340. +    QList<int> types;
  341. +    QList<int> syntaxes;
  342. +    QStringList patterns;
  343. +    foreach (const Data &data, m_data) {
  344. +        types << data.type;
  345. +        syntaxes << data.syntax;
  346. +        patterns << data.pattern;
  347. +    }
  348. +
  349. +    Settings::self()->setAutoPasteTypes(types);
  350. +    Settings::self()->setAutoPastePatternSyntaxes(syntaxes);
  351. +    Settings::self()->setAutoPastePatterns(patterns);
  352. +    Settings::self()->writeConfig();
  353. +}
  354. +
  355. +void AutoPasteModel::resetDefaults()
  356. +{
  357. +    QStringList names = QStringList() << "AutoPastePatterns" << "AutoPasteTypes" << "AutoPastePatternSyntaxes";
  358. +    foreach (const QString &name, names) {
  359. +        KConfigSkeletonItem *item = Settings::self()->findItem(name);
  360. +        if (item) {
  361. +            item->readDefault(Settings::self()->config());
  362. +        }
  363. +    }
  364. +
  365. +    load();
  366. +}
  367. +
  368. diff --git a/kget/conf/autopastemodel.h b/kget/conf/autopastemodel.h
  369. new file mode 100644
  370. index 0000000..b7fb18a
  371. --- /dev/null
  372. +++ b/kget/conf/autopastemodel.h
  373. @@ -0,0 +1,123 @@
  374. +/***************************************************************************
  375. +*   Copyright (C) 2010 Matthias Fuchs <mat69@gmx.net>                     *
  376. +*                                                                         *
  377. +*   This program is free software; you can redistribute it and/or modify  *
  378. +*   it under the terms of the GNU General Public License as published by  *
  379. +*   the Free Software Foundation; either version 2 of the License, or     *
  380. +*   (at your option) any later version.                                   *
  381. +*                                                                         *
  382. +*   This program is distributed in the hope that it will be useful,       *
  383. +*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
  384. +*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
  385. +*   GNU General Public License for more details.                          *
  386. +*                                                                         *
  387. +*   You should have received a copy of the GNU General Public License     *
  388. +*   along with this program; if not, write to the                         *
  389. +*   Free Software Foundation, Inc.,                                       *
  390. +*   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
  391. +***************************************************************************/
  392. +
  393. +#ifndef AUTOPASTEMODEL
  394. +#define AUTOPASTEMODEL
  395. +
  396. +#include <QtCore/QAbstractTableModel>
  397. +#include <QtGui/QStyledItemDelegate>
  398. +
  399. +class AutoPasteDelegate : public QStyledItemDelegate
  400. +{
  401. +    Q_OBJECT
  402. +
  403. +    public:
  404. +        AutoPasteDelegate(QAbstractItemModel *types, QAbstractItemModel *syntaxes, QObject *parent = 0);
  405. +
  406. +        QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
  407. +        void setEditorData(QWidget *editor, const QModelIndex &index) const;
  408. +        void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
  409. +        void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
  410. +        QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
  411. +
  412. +    private:
  413. +        QAbstractItemModel *m_types;
  414. +        QAbstractItemModel *m_syntaxes;
  415. +};
  416. +
  417. +class AutoPasteModel : public QAbstractTableModel
  418. +{
  419. +    Q_OBJECT
  420. +
  421. +    public:
  422. +        enum DataType {
  423. +            Type = 0,
  424. +            Pattern,
  425. +            PatternSyntax
  426. +        };
  427. +        enum TypeData {
  428. +            Include = 0,
  429. +            Exclude
  430. +        };
  431. +        enum PatternSyntaxData {
  432. +            Wildcard = 0,
  433. +            RegExp
  434. +        };
  435. +
  436. +        explicit AutoPasteModel(QObject *parent = 0);
  437. +        ~AutoPasteModel();
  438. +
  439. +        int rowCount(const QModelIndex &index = QModelIndex()) const;
  440. +        int columnCount(const QModelIndex &index = QModelIndex()) const;
  441. +        QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
  442. +        QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
  443. +        Qt::ItemFlags flags(const QModelIndex &index) const;
  444. +        bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
  445. +        bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
  446. +
  447. +        /**
  448. +         * Adds an an item
  449. +         * @note do not use this for loading data
  450. +         * @see load()
  451. +         */
  452. +        void addItem(TypeData dataType, PatternSyntaxData patternSyntax, const QString &pattern);
  453. +
  454. +        /**
  455. +         * Moves an item to a new position
  456. +         * @param sourceRow the current row of the selected item
  457. +         * @param destinationRow is the new row before the move,
  458. +         * i.e. if sourceRow was not removed from the model
  459. +         * @see QAbstractItemModel::beginMoveRows()
  460. +         */
  461. +        bool moveItem(int sourceRow, int destinationRow);
  462. +
  463. +    public slots:
  464. +        /**
  465. +         * Loads the stored data
  466. +         * @see save()
  467. +         */
  468. +        void load();
  469. +
  470. +        /**
  471. +         * Saves the current data
  472. +         * @see load()
  473. +         */
  474. +        void save();
  475. +
  476. +        /**
  477. +         * Resets the model to the default data
  478. +         */
  479. +        void resetDefaults();
  480. +
  481. +    private:
  482. +        void addItems(const QList<int> &dataTypes, const QList<int> patternSyntaxes, const QStringList &patterns);
  483. +
  484. +    private:
  485. +        struct Data
  486. +        {
  487. +            TypeData type;
  488. +            QString pattern;
  489. +            PatternSyntaxData syntax;
  490. +        };
  491. +
  492. +        QList<Data> m_data;
  493. +};
  494. +
  495. +#endif
  496. +
  497. diff --git a/kget/conf/dlgadvanced.ui b/kget/conf/dlgadvanced.ui
  498. index a64df1f..6e53289 100644
  499. --- a/kget/conf/dlgadvanced.ui
  500. +++ b/kget/conf/dlgadvanced.ui
  501. @@ -1,7 +1,8 @@
  502. -<ui version="4.0" >
  503. +<?xml version="1.0" encoding="UTF-8"?>
  504. +<ui version="4.0">
  505.   <class>DlgAdvanced</class>
  506. - <widget class="QWidget" name="DlgAdvanced" >
  507. -  <property name="geometry" >
  508. + <widget class="QWidget" name="DlgAdvanced">
  509. +  <property name="geometry">
  510.     <rect>
  511.      <x>0</x>
  512.      <y>0</y>
  513. @@ -9,60 +10,60 @@
  514.      <height>443</height>
  515.     </rect>
  516.    </property>
  517. -  <layout class="QVBoxLayout" name="verticalLayout" >
  518. +  <layout class="QVBoxLayout" name="verticalLayout">
  519.     <item>
  520. -    <widget class="QCheckBox" name="kcfg_ExpertMode" >
  521. -     <property name="text" >
  522. +    <widget class="QCheckBox" name="kcfg_ExpertMode">
  523. +     <property name="text">
  524.        <string>Disable confirmation dialogs (less verbosity)</string>
  525.       </property>
  526.      </widget>
  527.     </item>
  528.     <item>
  529. -    <widget class="QCheckBox" name="kcfg_EnableSystemTray" >
  530. -     <property name="text" >
  531. +    <widget class="QCheckBox" name="kcfg_EnableSystemTray">
  532. +     <property name="text">
  533.        <string>Enable system tray icon</string>
  534.       </property>
  535.      </widget>
  536.     </item>
  537.     <item>
  538. -    <layout class="QFormLayout" name="formLayout_2" >
  539. -     <item row="0" column="0" >
  540. -      <widget class="QCheckBox" name="kcfg_AfterFinishActionEnabled" >
  541. -       <property name="text" >
  542. +    <layout class="QFormLayout" name="formLayout_2">
  543. +     <item row="0" column="0">
  544. +      <widget class="QCheckBox" name="kcfg_AfterFinishActionEnabled">
  545. +       <property name="text">
  546.          <string>Execute action after all downloads have been finished:</string>
  547.         </property>
  548.        </widget>
  549.       </item>
  550. -     <item row="0" column="1" >
  551. -      <widget class="KComboBox" name="kcfg_AfterFinishAction" >
  552. +     <item row="0" column="1">
  553. +      <widget class="KComboBox" name="kcfg_AfterFinishAction">
  554.         <item>
  555. -        <property name="text" >
  556. +        <property name="text">
  557.           <string>Quit KGet</string>
  558.          </property>
  559.         </item>
  560.        </widget>
  561.       </item>
  562. -     <item row="1" column="0" >
  563. -      <widget class="QLabel" name="label_2" >
  564. -       <property name="text" >
  565. +     <item row="1" column="0">
  566. +      <widget class="QLabel" name="label_2">
  567. +       <property name="text">
  568.          <string>At startup:</string>
  569.         </property>
  570.        </widget>
  571.       </item>
  572. -     <item row="1" column="1" >
  573. -      <widget class="KComboBox" name="kcfg_StartupAction" >
  574. +     <item row="1" column="1">
  575. +      <widget class="KComboBox" name="kcfg_StartupAction">
  576.         <item>
  577. -        <property name="text" >
  578. +        <property name="text">
  579.           <string>Restore Download State</string>
  580.          </property>
  581.         </item>
  582.         <item>
  583. -        <property name="text" >
  584. +        <property name="text">
  585.           <string>Start All Downloads</string>
  586.          </property>
  587.         </item>
  588.         <item>
  589. -        <property name="text" >
  590. +        <property name="text">
  591.           <string>Stop All Downloads</string>
  592.          </property>
  593.         </item>
  594. @@ -71,69 +72,46 @@
  595.      </layout>
  596.     </item>
  597.     <item>
  598. -    <widget class="QGroupBox" name="groupBox" >
  599. -     <property name="title" >
  600. +    <widget class="QGroupBox" name="groupBox">
  601. +     <property name="title">
  602.        <string>History</string>
  603.       </property>
  604. -     <layout class="QFormLayout" name="formLayout" >
  605. -      <item row="0" column="0" >
  606. -       <widget class="QLabel" name="label" >
  607. -        <property name="text" >
  608. +     <layout class="QFormLayout" name="formLayout">
  609. +      <item row="0" column="0">
  610. +       <widget class="QLabel" name="label">
  611. +        <property name="text">
  612.           <string>History backend:</string>
  613.          </property>
  614.         </widget>
  615.        </item>
  616. -      <item row="0" column="1" >
  617. -       <widget class="KComboBox" name="kcfg_HistoryBackend" />
  618. +      <item row="0" column="1">
  619. +       <widget class="KComboBox" name="kcfg_HistoryBackend"/>
  620.        </item>
  621.       </layout>
  622.      </widget>
  623.     </item>
  624.     <item>
  625. -    <widget class="QGroupBox" name="groupBox4" >
  626. -     <property name="title" >
  627. -      <string>Integration</string>
  628. -     </property>
  629. -     <layout class="QVBoxLayout" >
  630. -      <item>
  631. -       <widget class="QCheckBox" name="kcfg_KonquerorIntegration" >
  632. -        <property name="text" >
  633. -         <string>Use as download manager for Konqueror</string>
  634. -        </property>
  635. -       </widget>
  636. -      </item>
  637. -      <item>
  638. -       <widget class="QCheckBox" name="kcfg_AutoPaste" >
  639. -        <property name="text" >
  640. -         <string>Monitor clipboard for files to download</string>
  641. -        </property>
  642. -       </widget>
  643. -      </item>
  644. -     </layout>
  645. -    </widget>
  646. -   </item>
  647. -   <item>
  648. -    <widget class="QGroupBox" name="kcfg_EnableKUIServerIntegration" >
  649. -     <property name="title" >
  650. +    <widget class="QGroupBox" name="kcfg_EnableKUIServerIntegration">
  651. +     <property name="title">
  652.        <string>Enable KDE global progress tracking</string>
  653.       </property>
  654. -     <property name="checkable" >
  655. +     <property name="checkable">
  656.        <bool>true</bool>
  657.       </property>
  658. -     <property name="checked" >
  659. +     <property name="checked">
  660.        <bool>false</bool>
  661.       </property>
  662. -     <layout class="QVBoxLayout" >
  663. +     <layout class="QVBoxLayout">
  664.        <item>
  665. -       <widget class="QRadioButton" name="kcfg_ExportSingleTransfer" >
  666. -        <property name="text" >
  667. +       <widget class="QRadioButton" name="kcfg_ExportSingleTransfer">
  668. +        <property name="text">
  669.           <string>Show every single download </string>
  670.          </property>
  671.         </widget>
  672.        </item>
  673.        <item>
  674. -       <widget class="QRadioButton" name="kcfg_ExportGlobalJob" >
  675. -        <property name="text" >
  676. +       <widget class="QRadioButton" name="kcfg_ExportGlobalJob">
  677. +        <property name="text">
  678.           <string>Show overall progress</string>
  679.          </property>
  680.         </widget>
  681. @@ -143,13 +121,13 @@
  682.     </item>
  683.     <item>
  684.      <spacer>
  685. -     <property name="orientation" >
  686. +     <property name="orientation">
  687.        <enum>Qt::Vertical</enum>
  688.       </property>
  689. -     <property name="sizeType" >
  690. +     <property name="sizeType">
  691.        <enum>QSizePolicy::Expanding</enum>
  692.       </property>
  693. -     <property name="sizeHint" stdset="0" >
  694. +     <property name="sizeHint" stdset="0">
  695.        <size>
  696.         <width>200</width>
  697.         <height>20</height>
  698. @@ -159,7 +137,7 @@
  699.     </item>
  700.    </layout>
  701.   </widget>
  702. -  <customwidgets>
  703. + <customwidgets>
  704.    <customwidget>
  705.     <class>KComboBox</class>
  706.     <extends>QComboBox</extends>
  707. diff --git a/kget/conf/dlgintegration.ui b/kget/conf/dlgintegration.ui
  708. new file mode 100644
  709. index 0000000..8df9073
  710. --- /dev/null
  711. +++ b/kget/conf/dlgintegration.ui
  712. @@ -0,0 +1,155 @@
  713. +<?xml version="1.0" encoding="UTF-8"?>
  714. +<ui version="4.0">
  715. + <class>DlgIntegration</class>
  716. + <widget class="QWidget" name="DlgIntegration">
  717. +  <property name="geometry">
  718. +   <rect>
  719. +    <x>0</x>
  720. +    <y>0</y>
  721. +    <width>558</width>
  722. +    <height>324</height>
  723. +   </rect>
  724. +  </property>
  725. +  <property name="windowTitle">
  726. +   <string>Form</string>
  727. +  </property>
  728. +  <layout class="QFormLayout" name="formLayout">
  729. +   <item row="0" column="0">
  730. +    <widget class="QLabel" name="label_4">
  731. +     <property name="text">
  732. +      <string>Use as download manager for Konqueror:</string>
  733. +     </property>
  734. +    </widget>
  735. +   </item>
  736. +   <item row="0" column="1">
  737. +    <widget class="QCheckBox" name="kcfg_KonquerorIntegration">
  738. +     <property name="text">
  739. +      <string/>
  740. +     </property>
  741. +    </widget>
  742. +   </item>
  743. +   <item row="1" column="0" colspan="2">
  744. +    <widget class="QGroupBox" name="kcfg_AutoPaste">
  745. +     <property name="title">
  746. +      <string>Monitor clipboard for files to download</string>
  747. +     </property>
  748. +     <property name="checkable">
  749. +      <bool>true</bool>
  750. +     </property>
  751. +     <property name="checked">
  752. +      <bool>false</bool>
  753. +     </property>
  754. +     <layout class="QFormLayout" name="formLayout_2">
  755. +      <item row="0" column="0">
  756. +       <widget class="QLabel" name="label_5">
  757. +        <property name="text">
  758. +         <string>Case insensitive:</string>
  759. +        </property>
  760. +       </widget>
  761. +      </item>
  762. +      <item row="0" column="1">
  763. +       <widget class="QCheckBox" name="kcfg_AutoPasteCaseInsensitive">
  764. +        <property name="text">
  765. +         <string/>
  766. +        </property>
  767. +       </widget>
  768. +      </item>
  769. +      <item row="1" column="0" colspan="2">
  770. +       <layout class="QHBoxLayout" name="horizontalLayout">
  771. +        <item>
  772. +         <widget class="KComboBox" name="type"/>
  773. +        </item>
  774. +        <item>
  775. +         <widget class="KComboBox" name="patternSyntax"/>
  776. +        </item>
  777. +        <item>
  778. +         <widget class="KLineEdit" name="pattern">
  779. +          <property name="trapEnterKeyEvent" stdset="0">
  780. +           <bool>true</bool>
  781. +          </property>
  782. +          <property name="showClearButton" stdset="0">
  783. +           <bool>true</bool>
  784. +          </property>
  785. +         </widget>
  786. +        </item>
  787. +       </layout>
  788. +      </item>
  789. +      <item row="2" column="0" colspan="2">
  790. +       <layout class="QHBoxLayout" name="horizontalLayout_2">
  791. +        <item>
  792. +         <widget class="QTreeView" name="list">
  793. +          <property name="selectionMode">
  794. +           <enum>QAbstractItemView::ExtendedSelection</enum>
  795. +          </property>
  796. +          <property name="rootIsDecorated">
  797. +           <bool>false</bool>
  798. +          </property>
  799. +          <property name="uniformRowHeights">
  800. +           <bool>true</bool>
  801. +          </property>
  802. +         </widget>
  803. +        </item>
  804. +        <item>
  805. +         <layout class="QVBoxLayout" name="verticalLayout_4">
  806. +          <item>
  807. +           <widget class="KPushButton" name="add"/>
  808. +          </item>
  809. +          <item>
  810. +           <widget class="KPushButton" name="remove"/>
  811. +          </item>
  812. +          <item>
  813. +           <widget class="KPushButton" name="increase">
  814. +            <property name="text">
  815. +             <string>Increase Priority</string>
  816. +            </property>
  817. +           </widget>
  818. +          </item>
  819. +          <item>
  820. +           <widget class="KPushButton" name="decrease">
  821. +            <property name="text">
  822. +             <string>Decrease Priority</string>
  823. +            </property>
  824. +           </widget>
  825. +          </item>
  826. +          <item>
  827. +           <spacer name="verticalSpacer">
  828. +            <property name="orientation">
  829. +             <enum>Qt::Vertical</enum>
  830. +            </property>
  831. +            <property name="sizeHint" stdset="0">
  832. +             <size>
  833. +              <width>20</width>
  834. +              <height>40</height>
  835. +             </size>
  836. +            </property>
  837. +           </spacer>
  838. +          </item>
  839. +         </layout>
  840. +        </item>
  841. +       </layout>
  842. +      </item>
  843. +     </layout>
  844. +    </widget>
  845. +   </item>
  846. +  </layout>
  847. + </widget>
  848. + <customwidgets>
  849. +  <customwidget>
  850. +   <class>KPushButton</class>
  851. +   <extends>QPushButton</extends>
  852. +   <header>kpushbutton.h</header>
  853. +  </customwidget>
  854. +  <customwidget>
  855. +   <class>KLineEdit</class>
  856. +   <extends>QLineEdit</extends>
  857. +   <header>klineedit.h</header>
  858. +  </customwidget>
  859. +  <customwidget>
  860. +   <class>KComboBox</class>
  861. +   <extends>QComboBox</extends>
  862. +   <header>kcombobox.h</header>
  863. +  </customwidget>
  864. + </customwidgets>
  865. + <resources/>
  866. + <connections/>
  867. +</ui>
  868. diff --git a/kget/conf/integrationpreferences.cpp b/kget/conf/integrationpreferences.cpp
  869. new file mode 100644
  870. index 0000000..77d75ed
  871. --- /dev/null
  872. +++ b/kget/conf/integrationpreferences.cpp
  873. @@ -0,0 +1,140 @@
  874. +/***************************************************************************
  875. +*   Copyright (C) 2010 Matthias Fuchs <mat69@gmx.net>                     *
  876. +*                                                                         *
  877. +*   This program is free software; you can redistribute it and/or modify  *
  878. +*   it under the terms of the GNU General Public License as published by  *
  879. +*   the Free Software Foundation; either version 2 of the License, or     *
  880. +*   (at your option) any later version.                                   *
  881. +*                                                                         *
  882. +*   This program is distributed in the hope that it will be useful,       *
  883. +*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
  884. +*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
  885. +*   GNU General Public License for more details.                          *
  886. +*                                                                         *
  887. +*   You should have received a copy of the GNU General Public License     *
  888. +*   along with this program; if not, write to the                         *
  889. +*   Free Software Foundation, Inc.,                                       *
  890. +*   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
  891. +***************************************************************************/
  892. +
  893. +#include "integrationpreferences.h"
  894. +#include "autopastemodel.h"
  895. +#include "settings.h"
  896. +
  897. +#include <KConfigDialog>
  898. +
  899. +IntegrationPreferences::IntegrationPreferences(KConfigDialog *parent, Qt::WindowFlags f)
  900. +  : QWidget(parent, f)
  901. +{
  902. +    ui.setupUi(this);
  903. +
  904. +    //AutoPaste stuff
  905. +    ui.type->addItem(KIcon("list-add"), i18n("Include"), AutoPasteModel::Include);
  906. +    ui.type->addItem(KIcon("list-remove"), i18n("Exclude"), AutoPasteModel::Exclude);
  907. +
  908. +    ui.patternSyntax->addItem(i18n("Escape sequences"), AutoPasteModel::Wildcard);
  909. +    ui.patternSyntax->addItem(i18n("Regular expression"), AutoPasteModel::RegExp);
  910. +
  911. +    ui.add->setGuiItem(KStandardGuiItem::add());
  912. +    ui.remove->setGuiItem(KStandardGuiItem::remove());
  913. +    ui.increase->setIcon(KIcon("arrow-up"));
  914. +    ui.decrease->setIcon(KIcon("arrow-down"));
  915. +
  916. +    m_model = new AutoPasteModel(this);
  917. +    m_model->load();
  918. +    ui.list->setModel(m_model);
  919. +    AutoPasteDelegate *delegate = new AutoPasteDelegate(ui.type->model(), ui.patternSyntax->model(), this);
  920. +    ui.list->setItemDelegate(delegate);
  921. +
  922. +    QByteArray loadedState = QByteArray::fromBase64(Settings::autoPasteHeaderState().toAscii());
  923. +    if (Settings::autoPasteHeaderState().isEmpty()) {
  924. +        ui.list->resizeColumnToContents(AutoPasteModel::Type);
  925. +    } else if (!loadedState.isNull()) {
  926. +        ui.list->header()->restoreState(loadedState);
  927. +    }
  928. +
  929. +    connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
  930. +    connect(ui.list->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(slotUpdateButtons()));
  931. +    connect(ui.pattern, SIGNAL(textChanged(QString)), this, SLOT(slotUpdateButtons()));
  932. +    connect(ui.pattern, SIGNAL(returnPressed(QString)), this, SLOT(slotAddItem()));
  933. +    connect(ui.add, SIGNAL(clicked()), this, SLOT(slotAddItem()));
  934. +    connect(ui.remove, SIGNAL(clicked()), this, SLOT(slotRemoveItem()));
  935. +    connect(ui.increase, SIGNAL(clicked()), this, SLOT(slotIncreasePriority()));
  936. +    connect(ui.decrease, SIGNAL(clicked()), this, SLOT(slotDecreasePriority()));
  937. +    connect(parent, SIGNAL(rejected()), m_model, SLOT(load()));
  938. +    connect(parent, SIGNAL(applyClicked()), m_model, SLOT(save()));
  939. +    connect(parent, SIGNAL(okClicked()), m_model, SLOT(save()));
  940. +    connect(parent, SIGNAL(defaultClicked()), m_model, SLOT(resetDefaults()));
  941. +
  942. +    slotUpdateButtons();
  943. +}
  944. +
  945. +IntegrationPreferences::~IntegrationPreferences()
  946. +{
  947. +}
  948. +
  949. +void IntegrationPreferences::slotUpdateButtons()
  950. +{
  951. +    ui.add->setEnabled(!ui.pattern->text().isEmpty());
  952. +    ui.remove->setEnabled(ui.list->selectionModel()->hasSelection());
  953. +
  954. +    const QModelIndex index = ui.list->currentIndex();
  955. +    bool up = false;
  956. +    bool down = false;
  957. +    const bool indexValid = index.isValid() && (ui.list->selectionModel()->selectedRows().count() == 1);
  958. +    if (indexValid) {
  959. +        if (index.row() > 0) {
  960. +            up = true;
  961. +        }
  962. +        if (m_model->rowCount() > (index.row() + 1)) {
  963. +            down = true;
  964. +        }
  965. +    }
  966. +    ui.increase->setEnabled(up);
  967. +    ui.decrease->setEnabled(down);
  968. +}
  969. +
  970. +void IntegrationPreferences::slotAddItem()
  971. +{
  972. +    const QString pattern = ui.pattern->text();
  973. +    if (pattern.isEmpty()) {
  974. +        return;
  975. +    }
  976. +
  977. +    AutoPasteModel::TypeData type = static_cast<AutoPasteModel::TypeData>(ui.type->itemData(ui.type->currentIndex()).toInt());
  978. +    AutoPasteModel::PatternSyntaxData syntax = static_cast<AutoPasteModel::PatternSyntaxData>(ui.patternSyntax->itemData(ui.patternSyntax->currentIndex()).toInt());
  979. +    m_model->addItem(type, syntax, pattern);
  980. +
  981. +    ui.pattern->clear();
  982. +    ui.pattern->setFocus();
  983. +    emit changed();
  984. +}
  985. +
  986. +void IntegrationPreferences::slotRemoveItem()
  987. +{
  988. +    QItemSelectionModel *selection = ui.list->selectionModel();
  989. +    if (selection->hasSelection()) {
  990. +        while (selection->selectedRows().count()) {
  991. +            const QModelIndex index = selection->selectedRows().first();
  992. +            m_model->removeRow(index.row());
  993. +        }
  994. +        emit changed();
  995. +    }
  996. +}
  997. +
  998. +void IntegrationPreferences::slotIncreasePriority()
  999. +{
  1000. +    const int row = ui.list->currentIndex().row();
  1001. +    m_model->moveItem(row, row - 1);
  1002. +    slotUpdateButtons();
  1003. +    emit changed();
  1004. +}
  1005. +
  1006. +void IntegrationPreferences::slotDecreasePriority()
  1007. +{
  1008. +    const int row = ui.list->currentIndex().row();
  1009. +    m_model->moveItem(row, row + 2);
  1010. +    slotUpdateButtons();
  1011. +    emit changed();
  1012. +}
  1013. +
  1014. diff --git a/kget/conf/integrationpreferences.h b/kget/conf/integrationpreferences.h
  1015. new file mode 100644
  1016. index 0000000..5cd4e02
  1017. --- /dev/null
  1018. +++ b/kget/conf/integrationpreferences.h
  1019. @@ -0,0 +1,57 @@
  1020. +/***************************************************************************
  1021. +*   Copyright (C) 2010 Matthias Fuchs <mat69@gmx.net>                     *
  1022. +*                                                                         *
  1023. +*   This program is free software; you can redistribute it and/or modify  *
  1024. +*   it under the terms of the GNU General Public License as published by  *
  1025. +*   the Free Software Foundation; either version 2 of the License, or     *
  1026. +*   (at your option) any later version.                                   *
  1027. +*                                                                         *
  1028. +*   This program is distributed in the hope that it will be useful,       *
  1029. +*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
  1030. +*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
  1031. +*   GNU General Public License for more details.                          *
  1032. +*                                                                         *
  1033. +*   You should have received a copy of the GNU General Public License     *
  1034. +*   along with this program; if not, write to the                         *
  1035. +*   Free Software Foundation, Inc.,                                       *
  1036. +*   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
  1037. +***************************************************************************/
  1038. +
  1039. +#ifndef INTEGRATIONPREFERENCES
  1040. +#define INTEGRATIONPREFERENCES
  1041. +
  1042. +#include <QtGui/QWidget>
  1043. +
  1044. +#include "ui_dlgintegration.h"
  1045. +
  1046. +class AutoPasteModel;
  1047. +class KConfigDialog;
  1048. +
  1049. +class IntegrationPreferences : public QWidget
  1050. +{
  1051. +    Q_OBJECT
  1052. +
  1053. +    public:
  1054. +        explicit IntegrationPreferences(KConfigDialog *parent, Qt::WindowFlags f = 0);
  1055. +        ~IntegrationPreferences();
  1056. +
  1057. +    private slots:
  1058. +        void slotUpdateButtons();
  1059. +        void slotAddItem();
  1060. +        void slotRemoveItem();
  1061. +        void slotIncreasePriority();
  1062. +        void slotDecreasePriority();
  1063. +
  1064. +    signals:
  1065. +        /**
  1066. +         * Emitted whenever something changes
  1067. +         */
  1068. +        void changed();
  1069. +
  1070. +    private:
  1071. +        Ui::DlgIntegration ui;
  1072. +        AutoPasteModel *m_model;
  1073. +};
  1074. +
  1075. +#endif
  1076. +
  1077. diff --git a/kget/conf/kget.kcfg b/kget/conf/kget.kcfg
  1078. index 220fa1a..997e1c6 100644
  1079. --- a/kget/conf/kget.kcfg
  1080. +++ b/kget/conf/kget.kcfg
  1081. @@ -15,6 +15,8 @@
  1082.      </entry>
  1083.      <entry name="VerificationHeaderState" type="String">
  1084.      </entry>
  1085. +    <entry name="AutoPasteHeaderState" type="String">
  1086. +    </entry>
  1087.      <entry name="ShowMain" type="Bool">
  1088.        <default>true</default>
  1089.      </entry>
  1090. @@ -49,6 +51,18 @@
  1091.      <entry name="AutoPaste" type="Bool">
  1092.        <default>false</default>
  1093.      </entry>
  1094. +    <entry name="AutoPasteCaseInsensitive" type="Bool">
  1095. +        <default>true</default>
  1096. +    </entry>
  1097. +    <entry name="AutoPastePatterns" type="StringList">
  1098. +        <default>*</default>
  1099. +    </entry>
  1100. +    <entry name="AutoPasteTypes" type="IntList">
  1101. +        <default>0</default>
  1102. +    </entry>
  1103. +    <entry name="AutoPastePatternSyntaxes" type="IntList">
  1104. +        <default>0</default>
  1105. +    </entry>
  1106.      <entry name="TimedDownload" type="Bool">
  1107.        <default>false</default>
  1108.      </entry>
  1109. diff --git a/kget/conf/preferencesdialog.cpp b/kget/conf/preferencesdialog.cpp
  1110. index 8973813..6c1c53f 100644
  1111. --- a/kget/conf/preferencesdialog.cpp
  1112. +++ b/kget/conf/preferencesdialog.cpp
  1113. @@ -15,6 +15,7 @@
  1114.  #include "ui_dlgnetwork.h"
  1115.  #include "dlgwebinterface.h"
  1116.  
  1117. +#include "integrationpreferences.h"
  1118.  #include "transfersgroupwidget.h"
  1119.  #include "pluginselector.h"
  1120.  #include "verificationpreferences.h"
  1121. @@ -30,6 +31,8 @@ PreferencesDialog::PreferencesDialog(QWidget * parent, KConfigSkeleton * skeleto
  1122.      DlgWebinterface *webinterface = new DlgWebinterface(this);
  1123.      QWidget *network = new QWidget(this);
  1124.      QWidget *advanced = new QWidget(this);
  1125. +    IntegrationPreferences *integration = new IntegrationPreferences(this);
  1126. +    connect(integration, SIGNAL(changed()), SLOT(enableApplyButton()));
  1127.      VerificationPreferences *verification = new VerificationPreferences(this);
  1128.      connect(verification, SIGNAL(changed()), SLOT(enableApplyButton()));
  1129.      PluginSelector * pluginSelector = new PluginSelector(this);
  1130. @@ -74,6 +77,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent, KConfigSkeleton * skeleto
  1131.      addPage(network, i18n("Network"), "network-workgroup", i18n("Network and Downloads"));
  1132.      addPage(webinterface, i18n("Web Interface"), "network-workgroup", i18n("Control KGet over a Network or the Internet"));
  1133.      addPage(verification, i18n("Verification"), "document-encrypt", i18n("Verification"));
  1134. +    addPage(integration, i18nc("integration of KGet with other applications", "Integration"), "preferences-other", i18nc("integration of KGet with other applications", "Integration"));
  1135.      addPage(advanced, i18nc("Advanced Options", "Advanced"), "preferences-other", i18n("Advanced Options"));
  1136.      addPage(pluginSelector, i18n("Plugins"), "preferences-plugin", i18n("Transfer Plugins"));
  1137.  
  1138. diff --git a/kget/mainwindow.cpp b/kget/mainwindow.cpp
  1139. index aa93f75..24f10db 100644
  1140. --- a/kget/mainwindow.cpp
  1141. +++ b/kget/mainwindow.cpp
  1142. @@ -22,6 +22,7 @@
  1143.  #include "core/transfertreemodel.h"
  1144.  #include "core/transfertreeselectionmodel.h"
  1145.  #include "settings.h"
  1146. +#include "conf/autopastemodel.h"
  1147.  #include "conf/preferencesdialog.h"
  1148.  #include "ui/viewscontainer.h"
  1149.  #include "ui/tray.h"
  1150. @@ -967,7 +968,26 @@ void MainWindow::slotCheckClipboard()
  1151.  
  1152.          const KUrl url = KUrl(lastClipboard);
  1153.          if (url.isValid() && !url.protocol().isEmpty() && url.hasPath() && url.hasHost() && !url.isLocalFile()) {
  1154. -            KGet::addTransfer( url );
  1155. +            bool add = false;
  1156. +            const QString urlString = url.url();
  1157. +
  1158. +            //check the combined whitelist and blacklist
  1159. +            const QList<int> types = Settings::autoPasteTypes();
  1160. +            const QList<int> syntaxes = Settings::autoPastePatternSyntaxes();
  1161. +            const QStringList patterns = Settings::autoPastePatterns();
  1162. +            const Qt::CaseSensitivity cs = (Settings::autoPasteCaseInsensitive() ? Qt::CaseInsensitive : Qt::CaseSensitive);
  1163. +            for (int i = 0; i < types.count(); ++i) {
  1164. +                const QRegExp::PatternSyntax syntax = (syntaxes[i] == AutoPasteModel::Wildcard ? QRegExp::Wildcard : QRegExp::RegExp2);
  1165. +                QRegExp rx(patterns[i], cs, syntax);//TODO case insensitivity + type
  1166. +                if (rx.exactMatch(urlString)) {
  1167. +                    add = (types[i] == AutoPasteModel::Include);
  1168. +                    break;
  1169. +                }
  1170. +            }
  1171. +
  1172. +            if (add) {
  1173. +                KGet::addTransfer(url);
  1174. +            }
  1175.          }
  1176.      }
  1177.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement