зеркало из https://github.com/nextcloud/desktop.git
ActivityWidget: open local file in file manager if exists.
This commit is contained in:
Родитель
631cb095dd
Коммит
a56926b8d9
|
@ -81,6 +81,7 @@ void ActivityItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
|||
QIcon userIcon = qvariant_cast<QIcon>(index.data(UserIconRole));
|
||||
QString actionText = qvariant_cast<QString>(index.data(ActionTextRole));
|
||||
QString pathText = qvariant_cast<QString>(index.data(PathRole));
|
||||
|
||||
QString remoteLink = qvariant_cast<QString>(index.data(LinkRole));
|
||||
QString timeText = qvariant_cast<QString>(index.data(PointInTimeRole));
|
||||
QString accountRole = qvariant_cast<QString>(index.data(AccountRole));
|
||||
|
|
|
@ -72,6 +72,7 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
|
|||
return QVariant();
|
||||
|
||||
switch (role) {
|
||||
case ActivityItemDelegate::PathRole:
|
||||
case Qt::ToolTipRole:
|
||||
list = FolderMan::instance()->findFileInLocalFolders(a._file);
|
||||
if( list.count() > 0 ) {
|
||||
|
@ -89,9 +90,6 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
|
|||
case ActivityItemDelegate::ActionTextRole:
|
||||
return a._subject;
|
||||
break;
|
||||
case ActivityItemDelegate::PathRole:
|
||||
return a._file;
|
||||
break;
|
||||
case ActivityItemDelegate::LinkRole:
|
||||
return a._link;
|
||||
break;
|
||||
|
@ -308,6 +306,9 @@ ActivityWidget::ActivityWidget(QWidget *parent) :
|
|||
connect(_copyBtn, SIGNAL(clicked()), SIGNAL(copyToClipboard()));
|
||||
|
||||
connect(_model, SIGNAL(rowsInserted(QModelIndex,int,int)), SIGNAL(rowsInserted()));
|
||||
|
||||
connect( _ui->_activityList, SIGNAL(activated(QModelIndex)), this,
|
||||
SLOT(slotOpenFile(QModelIndex)));
|
||||
}
|
||||
|
||||
ActivityWidget::~ActivityWidget()
|
||||
|
@ -362,22 +363,15 @@ void ActivityWidget::storeActivityList( QTextStream& ts )
|
|||
}
|
||||
}
|
||||
|
||||
void ActivityWidget::slotOpenFile( )
|
||||
void ActivityWidget::slotOpenFile(QModelIndex indx)
|
||||
{
|
||||
// FIXME make work at all.
|
||||
#if 0
|
||||
QString folderName = item->data(2, Qt::UserRole).toString();
|
||||
QString fileName = item->text(1);
|
||||
if( indx.isValid() ) {
|
||||
QString fullPath = indx.data(ActivityItemDelegate::PathRole).toString();
|
||||
|
||||
Folder *folder = FolderMan::instance()->folder(folderName);
|
||||
if (folder) {
|
||||
// folder->path() always comes back with trailing path
|
||||
QString fullPath = folder->path() + fileName;
|
||||
if (QFile(fullPath).exists()) {
|
||||
if (QFile::exists(fullPath)) {
|
||||
showInFileManager(fullPath);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ public:
|
|||
void storeActivityList(QTextStream &ts);
|
||||
|
||||
public slots:
|
||||
void slotOpenFile();
|
||||
void slotOpenFile(QModelIndex indx);
|
||||
void slotRefresh(AccountState* ptr);
|
||||
void slotRemoveAccount( AccountState *ptr );
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче