2018-11-17 08:10:08 -05:00
|
|
|
/*******************************************************************************
|
|
|
|
* retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.h *
|
|
|
|
* *
|
|
|
|
* Copyright (C) 2018 by Retroshare Team <retroshare.project@gmail.com> *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Affero General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Affero General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Affero General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
|
|
|
|
2017-10-12 15:33:39 -04:00
|
|
|
#ifndef PGPID_ITEM_PROXY_H
|
|
|
|
#define PGPID_ITEM_PROXY_H
|
|
|
|
|
2018-02-10 09:42:24 -05:00
|
|
|
#include "util/cxx11retrocompat.h"
|
2019-01-10 17:43:19 -05:00
|
|
|
#include "pgpid_item_model.h"
|
2018-02-10 09:42:24 -05:00
|
|
|
|
2017-10-12 15:33:39 -04:00
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
|
|
|
|
class pgpid_item_proxy :
|
|
|
|
public QSortFilterProxyModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
pgpid_item_proxy(QObject *parent = nullptr);
|
2017-10-18 17:24:54 -04:00
|
|
|
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
2019-01-06 14:58:32 -05:00
|
|
|
|
|
|
|
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
|
|
|
|
{
|
2019-01-10 17:43:19 -05:00
|
|
|
if(left.column() == COLUMN_LAST_USED)
|
|
|
|
return left.data(Qt::EditRole).toUInt() < right.data(Qt::EditRole).toUInt();
|
|
|
|
else
|
|
|
|
return left.data(Qt::DisplayRole).toString().toUpper() < right.data(Qt::DisplayRole).toString().toUpper();
|
2019-01-06 14:58:32 -05:00
|
|
|
}
|
|
|
|
|
2017-10-18 17:24:54 -04:00
|
|
|
public slots:
|
|
|
|
void use_only_trusted_keys(bool val);
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool only_trusted_keys = false;
|
2017-10-12 15:33:39 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PGPID_ITEM_PROXY_H
|