2007-11-14 22:18:48 -05:00
|
|
|
/****************************************************************
|
2009-04-09 14:22:55 -04:00
|
|
|
* RetroShare is distributed under the following license:
|
2007-11-14 22:18:48 -05:00
|
|
|
*
|
2009-04-09 14:22:55 -04:00
|
|
|
* Copyright (C) 2006-2009, RetroShare Team
|
2007-11-14 22:18:48 -05:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2009-08-17 16:19:53 -04:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
2007-11-14 22:18:48 -05:00
|
|
|
* Boston, MA 02110-1301, USA.
|
2009-01-01 19:09:59 -05:00
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#ifndef _SHAREDFILESDIALOG_H
|
|
|
|
#define _SHAREDFILESDIALOG_H
|
|
|
|
|
2010-01-31 09:21:24 -05:00
|
|
|
#include "RsAutoUpdatePage.h"
|
2009-01-01 19:09:59 -05:00
|
|
|
#include "ui_SharedFilesDialog.h"
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2011-04-01 17:46:06 -04:00
|
|
|
class RetroshareDirModel;
|
2010-09-19 20:10:51 -04:00
|
|
|
class QSortFilterProxyModel;
|
2009-01-01 19:09:59 -05:00
|
|
|
|
2010-01-31 09:21:24 -05:00
|
|
|
class SharedFilesDialog : public RsAutoUpdatePage
|
2009-01-01 19:09:59 -05:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
/** Default Constructor */
|
2013-02-22 16:42:27 -05:00
|
|
|
SharedFilesDialog(RetroshareDirModel *tree_model,RetroshareDirModel *flat_model,QWidget *parent = 0);
|
|
|
|
|
2009-01-01 19:09:59 -05:00
|
|
|
/** Default Destructor */
|
2013-02-22 16:42:27 -05:00
|
|
|
~SharedFilesDialog() {}
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2011-04-14 17:58:15 -04:00
|
|
|
virtual void hideEvent(QHideEvent *) ;
|
|
|
|
virtual void showEvent(QShowEvent *) ;
|
2009-01-01 19:09:59 -05:00
|
|
|
|
2013-02-22 16:42:27 -05:00
|
|
|
protected:
|
|
|
|
QTreeView *directoryView() ;
|
|
|
|
virtual void showProperColumns() = 0 ;
|
|
|
|
virtual bool isRemote() const = 0 ;
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
virtual void spawnCustomPopupMenu(QPoint point) = 0;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
2009-02-12 06:48:43 -05:00
|
|
|
/* For handling the model updates */
|
2014-01-05 17:51:54 -05:00
|
|
|
void preModDirectories(bool local) ;
|
|
|
|
void postModDirectories(bool local) ;
|
2008-03-31 14:37:50 -04:00
|
|
|
|
2009-01-01 19:09:59 -05:00
|
|
|
/** Create the context popup menu and it's submenus */
|
2013-02-22 16:42:27 -05:00
|
|
|
// void customPopupMenu(QPoint point) ;
|
2009-08-17 16:19:53 -04:00
|
|
|
|
2013-02-22 16:42:27 -05:00
|
|
|
void copyLink();
|
2010-03-04 10:42:50 -05:00
|
|
|
void copyLinkhtml();
|
2009-05-18 10:23:55 -04:00
|
|
|
void sendLinkTo();
|
2010-11-20 15:58:35 -05:00
|
|
|
#ifdef RS_USE_LINKS
|
2009-08-17 16:19:53 -04:00
|
|
|
void sendLinkToCloud();
|
|
|
|
void addLinkToCloud();
|
2010-11-20 15:58:35 -05:00
|
|
|
#endif
|
2009-05-18 10:23:55 -04:00
|
|
|
|
2014-05-29 10:49:45 -04:00
|
|
|
void collCreate();
|
|
|
|
void collModif();
|
|
|
|
void collView();
|
|
|
|
void collOpen();
|
|
|
|
|
2013-02-22 16:42:27 -05:00
|
|
|
//== void showFrame(bool show);
|
|
|
|
//== void showFrameRemote(bool show);
|
|
|
|
//== void showFrameSplitted(bool show);
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-11-07 16:33:48 -05:00
|
|
|
void recommendFilesToMsg();
|
2009-10-13 16:36:29 -04:00
|
|
|
|
|
|
|
void indicatorChanged(int index);
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-11-30 07:29:04 -05:00
|
|
|
void filterRegExpChanged();
|
|
|
|
void clearFilter();
|
|
|
|
void startFilter();
|
|
|
|
|
2011-04-01 17:46:06 -04:00
|
|
|
public slots:
|
2014-05-29 10:49:45 -04:00
|
|
|
void changeCurrentViewModel(int viewTypeIndex);
|
2008-03-31 14:37:50 -04:00
|
|
|
signals:
|
|
|
|
void playFiles(QStringList files);
|
|
|
|
|
2013-02-22 16:42:27 -05:00
|
|
|
protected:
|
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::SharedFilesDialog ui;
|
|
|
|
virtual void processSettings(bool bLoad) = 0;
|
|
|
|
|
|
|
|
protected:
|
2009-04-07 04:08:03 -04:00
|
|
|
//now context menu are created again every time theu are called ( in some
|
|
|
|
//slots.. Maybe it's not good...
|
|
|
|
//** Define the popup menus for the Context menu */
|
|
|
|
//QMenu* contextMnu;
|
2009-08-17 16:19:53 -04:00
|
|
|
|
2009-04-07 04:08:03 -04:00
|
|
|
//QMenu* contextMnu2;
|
2009-08-17 16:19:53 -04:00
|
|
|
|
2010-11-30 07:29:04 -05:00
|
|
|
void copyLink (const QModelIndexList& lst, bool remote);
|
|
|
|
|
|
|
|
void FilterItems();
|
2011-04-01 17:46:06 -04:00
|
|
|
bool tree_FilterItem(const QModelIndex &index, const QString &text, int level);
|
|
|
|
bool flat_FilterItem(const QModelIndex &index, const QString &text, int level);
|
2009-08-17 16:19:53 -04:00
|
|
|
|
2013-02-22 16:42:27 -05:00
|
|
|
QModelIndexList getSelected();
|
2010-09-19 20:10:51 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
/** Defines the actions for the context menu for QTreeWidget */
|
2013-02-22 16:42:27 -05:00
|
|
|
QAction* copylinkAct;
|
2014-01-05 17:51:54 -05:00
|
|
|
QAction* sendlinkAct;
|
2010-11-20 15:58:35 -05:00
|
|
|
#ifdef RS_USE_LINKS
|
2009-08-17 16:19:53 -04:00
|
|
|
QAction* sendlinkCloudAct;
|
|
|
|
QAction* addlinkCloudAct;
|
2010-11-20 15:58:35 -05:00
|
|
|
#endif
|
2010-02-01 09:47:54 -05:00
|
|
|
QAction* sendchatlinkAct;
|
2013-02-22 16:42:27 -05:00
|
|
|
QAction* copylinkhtmlAct;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2014-05-29 10:49:45 -04:00
|
|
|
QAction *collCreateAct;
|
|
|
|
QAction *collModifAct;
|
|
|
|
QAction *collViewAct;
|
|
|
|
QAction *collOpenAct;
|
|
|
|
|
2011-04-01 17:46:06 -04:00
|
|
|
/* RetroshareDirModel */
|
|
|
|
RetroshareDirModel *tree_model;
|
|
|
|
RetroshareDirModel *flat_model;
|
|
|
|
RetroshareDirModel *model;
|
|
|
|
QSortFilterProxyModel *tree_proxyModel;
|
|
|
|
QSortFilterProxyModel *flat_proxyModel;
|
2010-09-19 20:10:51 -04:00
|
|
|
QSortFilterProxyModel *proxyModel;
|
2011-04-01 17:46:06 -04:00
|
|
|
|
2009-04-07 04:08:03 -04:00
|
|
|
QString currentCommand;
|
|
|
|
QString currentFile;
|
2009-08-17 16:19:53 -04:00
|
|
|
|
2010-11-30 07:29:04 -05:00
|
|
|
QString lastFilterString;
|
2013-02-22 16:42:27 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class LocalSharedFilesDialog : public SharedFilesDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
LocalSharedFilesDialog(QWidget *parent=NULL) ;
|
|
|
|
virtual ~LocalSharedFilesDialog();
|
|
|
|
|
|
|
|
virtual void spawnCustomPopupMenu(QPoint point);
|
|
|
|
virtual void updatePage() { checkUpdate() ; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void processSettings(bool bLoad) ;
|
|
|
|
virtual void showProperColumns() ;
|
|
|
|
virtual bool isRemote() const { return false ; }
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void addShares();
|
|
|
|
void checkUpdate() ;
|
|
|
|
void editSharePermissions();
|
|
|
|
void playselectedfiles();
|
|
|
|
void openfile();
|
|
|
|
void openfolder();
|
|
|
|
void runCommandForFile();
|
|
|
|
void tryToAddNewAssotiation();
|
|
|
|
void forceCheck();
|
|
|
|
|
|
|
|
QAction* fileAssotiationAction(const QString fileName);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QAction* openfileAct;
|
|
|
|
QAction* openfolderAct;
|
|
|
|
QAction* editshareAct;
|
|
|
|
};
|
2014-05-29 10:49:45 -04:00
|
|
|
|
2013-02-22 16:42:27 -05:00
|
|
|
class RemoteSharedFilesDialog : public SharedFilesDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
RemoteSharedFilesDialog(QWidget *parent=NULL) ;
|
|
|
|
virtual ~RemoteSharedFilesDialog() ;
|
|
|
|
|
|
|
|
virtual void spawnCustomPopupMenu(QPoint point);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void processSettings(bool bLoad) ;
|
|
|
|
virtual void showProperColumns() ;
|
|
|
|
virtual bool isRemote() const { return true ; }
|
2010-11-30 07:29:04 -05:00
|
|
|
|
2013-02-22 16:42:27 -05:00
|
|
|
private slots:
|
|
|
|
void downloadRemoteSelected();
|
2009-01-01 19:09:59 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|