added a dialog to edit banned files

This commit is contained in:
csoler 2018-08-16 22:22:47 +02:00
parent 50e03a539c
commit e17c4d0e40
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
9 changed files with 164 additions and 6 deletions

View File

@ -107,7 +107,7 @@ class RsFileListsBannedHashesItem: public RsFileListsItem
public:
RsFileListsBannedHashesItem() : RsFileListsItem(RS_PKT_SUBTYPE_FILELISTS_BANNED_HASHES_ITEM){}
virtual void clear();
virtual void clear() { encrypted_hashes.clear(); }
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
std::set<RsFileHash> encrypted_hashes ;// hash of hash for each banned file.

View File

@ -0,0 +1,36 @@
/*******************************************************************************
* retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp *
* *
* Copyright 2018 by Retroshare Team <retroshare.team@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/>. *
* *
*******************************************************************************/
#include "retroshare/rsfiles.h"
#include "BannedFilesDialog.h"
BannedFilesDialog::BannedFilesDialog(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
}
BannedFilesDialog::~BannedFilesDialog() {}
void BannedFilesDialog::unbanFile()
{
#warning Code missing here
}

View File

@ -0,0 +1,46 @@
/*******************************************************************************
* retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h *
* *
* Copyright 2018 by Retroshare Team <retroshare.team@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/>. *
* *
*******************************************************************************/
#pragma once
#include "RsAutoUpdatePage.h"
#include "ui_BannedFilesDialog.h"
class BannedFilesDialog: public QDialog
{
Q_OBJECT
public:
/** Default Constructor */
BannedFilesDialog(QWidget *parent = 0);
/** Default Destructor */
~BannedFilesDialog();
private slots:
void unbanFile();
/** management of the adv search dialog object when switching search modes */
//void hideEvent(QHideEvent * event);
private:
/** Qt Designer generated object */
Ui::BannedFilesDialog ui;
};

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BannedFilesDialog</class>
<widget class="QDialog" name="BannedFilesDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>923</width>
<height>810</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTableWidget" name="bannedFiles_TW">
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Filename</string>
</property>
</column>
<column>
<property name="text">
<string>Hash</string>
</property>
</column>
<column>
<property name="text">
<string>Size</string>
</property>
</column>
<column>
<property name="text">
<string>Banned since...</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -26,6 +26,7 @@
#include "rshare.h"
#include "SearchDialog.h"
#include "gui/FileTransfer/BannedFilesDialog.h"
#include "gui/RSHumanReadableDelegate.h"
#include "gui/RetroShareLink.h"
#include "retroshare-gui/RsAutoUpdatePage.h"
@ -118,6 +119,7 @@ SearchDialog::SearchDialog(QWidget *parent)
connect( ui.searchResultWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( searchResultWidgetCustomPopupMenu( QPoint ) ) );
connect( ui.searchSummaryWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( searchSummaryWidgetCustomPopupMenu( QPoint ) ) );
connect( ui.showBannedFiles_TB, SIGNAL( clicked() ), this, SLOT( openBannedFiles() ) );
connect( ui.lineEdit, SIGNAL( returnPressed ( void ) ), this, SLOT( searchKeywords( void ) ) );
connect( ui.lineEdit, SIGNAL( textChanged ( const QString& ) ), this, SLOT( checkText( const QString& ) ) );
@ -443,11 +445,17 @@ void SearchDialog::ban()
rsFiles -> banFile( hash, (item->text(SR_NAME_COL)).toUtf8().constData() , (item->text(SR_SIZE_COL)).toULongLong());
ui.searchResultWidget->takeItem(item) ;
ui.searchResultWidget->takeTopLevelItem(ui.searchResultWidget->indexOfTopLevelItem(item)) ;
}
}
}
void SearchDialog::openBannedFiles()
{
BannedFilesDialog d ;
d.exec();
}
void SearchDialog::collCreate()
{
std::vector <DirDetails> dirVec;

View File

@ -87,6 +87,7 @@ private slots:
void recommendtofriends();
void checkText(const QString&);
void openBannedFiles();
void copyResultLink();
void copySearchLink();
void openFolderSearch();

View File

@ -170,6 +170,23 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="showBannedFiles_TB">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/biohazard_red.png</normaloff>:/icons/biohazard_red.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -450,6 +467,7 @@
</customwidget>
</customwidgets>
<resources>
<include location="../icons.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>

View File

@ -55,7 +55,8 @@ public:
/* Fixed numbers for load and save the last page */
SearchTab = 0, /** Network page. */
LocalSharedFilesTab = 1, /** Network new graph. */
RemoteSharedFilesTab = 2 /** Old group chat page. */
RemoteSharedFilesTab = 2, /** Old group chat page. */
DownloadTab = 3
};
@ -108,9 +109,6 @@ private slots:
void expandAllUL();
void collapseAllUL();
// void rootdecorated();
// void rootisnotdecorated();
void pauseFileTransfer();
void resumeFileTransfer();
void dlOpenFolder();

View File

@ -365,6 +365,7 @@ HEADERS += rshare.h \
gui/FileTransfer/DLListDelegate.h \
gui/FileTransfer/ULListDelegate.h \
gui/FileTransfer/TransfersDialog.h \
gui/FileTransfer/BannedFilesDialog.h \
gui/statistics/TurtleRouterDialog.h \
gui/statistics/TurtleRouterStatistics.h \
gui/statistics/dhtgraph.h \
@ -597,6 +598,7 @@ FORMS += gui/StartDialog.ui \
gui/FileTransfer/DetailsDialog.ui \
gui/FileTransfer/SearchDialog.ui \
gui/FileTransfer/SharedFilesDialog.ui \
gui/FileTransfer/BannedFilesDialog.ui \
gui/MainWindow.ui \
gui/NetworkView.ui \
gui/MessengerWindow.ui \
@ -743,6 +745,7 @@ SOURCES += main.cpp \
gui/FileTransfer/xprogressbar.cpp \
gui/FileTransfer/DetailsDialog.cpp \
gui/FileTransfer/TransferUserNotify.cpp \
gui/FileTransfer/BannedFilesDialog.cpp \
gui/MainPage.cpp \
gui/HelpDialog.cpp \
gui/LogoBar.cpp \