Merge pull request #2759 from csoler/v0.6-BugFixing_30

GUI bug fixing
This commit is contained in:
csoler 2023-07-31 20:03:40 +02:00 committed by GitHub
commit 39ae560885
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 33 deletions

View File

@ -2074,22 +2074,23 @@ void TransfersDialog::dlOpenFolder()
break;
}
openFolder(info);
}
void TransfersDialog::openFolder(const FileInfo& info)
{
/* make path for downloaded or downloading files */
QFileInfo qinfo;
std::string path;
if (info.downloadStatus == FT_STATE_COMPLETE) {
path = info.path;
} else {
path = rsFiles->getPartialsDirectory();
}
QDir directory;
if (info.downloadStatus == FT_STATE_COMPLETE)
directory = QFileInfo(QString::fromStdString(info.path)).absoluteDir().path();
else
directory = QDir(QString::fromStdString(rsFiles->getPartialsDirectory()));
/* open folder with a suitable application */
qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists() && qinfo.isDir()) {
if (!RsUrlHandler::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()))) {
std::cerr << "dlOpenFolder(): can't open folder " << path << std::endl;
}
}
if (directory.exists() && !RsUrlHandler::openUrl(QUrl::fromLocalFile(directory.path())))
std::cerr << "dlOpenFolder(): can't open folder " << directory.path().toStdString() << std::endl;
}
void TransfersDialog::ulOpenFolder()
@ -2104,19 +2105,7 @@ void TransfersDialog::ulOpenFolder()
break;
}
/* make path for uploading files */
QFileInfo qinfo;
std::string path;
path = info.path.substr(0,info.path.length()-info.fname.length());
/* open folder with a suitable application */
qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists() && qinfo.isDir()) {
if (!RsUrlHandler::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()))) {
std::cerr << "ulOpenFolder(): can't open folder " << path << std::endl;
}
}
openFolder(info);
}
void TransfersDialog::dlPreviewFile()
@ -2139,7 +2128,7 @@ void TransfersDialog::dlPreviewFile()
/* make path for downloaded or downloading files */
QFileInfo fileInfo;
if (info.downloadStatus == FT_STATE_COMPLETE) {
fileInfo = QFileInfo(QString::fromUtf8(info.path.c_str()), QString::fromUtf8(info.fname.c_str()));
fileInfo = QFileInfo(QString::fromUtf8(info.path.c_str()));
} else {
fileInfo = QFileInfo(QString::fromUtf8(rsFiles->getPartialsDirectory().c_str()), QString::fromUtf8(info.hash.toStdString().c_str()));
@ -2204,7 +2193,7 @@ void TransfersDialog::dlOpenFile()
/* make path for downloaded or downloading files */
std::string path;
if (info.downloadStatus == FT_STATE_COMPLETE) {
path = info.path + "/" + info.fname;
path = info.path ;
/* open file with a suitable application */
QFileInfo qinfo;

View File

@ -173,6 +173,7 @@ signals:
void playFiles(QStringList files);
private:
void openFolder(const FileInfo& info);
RsDownloadListModel *DLListModel;
QSortFilterProxyModel *DLLFilterModel;

View File

@ -464,11 +464,7 @@ void GxsCommentTreeWidget::replyToComment()
void GxsCommentTreeWidget::copyComment()
{
QString txt = dynamic_cast<QAction*>(sender())->data().toString();
QMimeData *mimeData = new QMimeData();
mimeData->setHtml("<html>"+txt+"</html>");
QClipboard *clipboard = QApplication::clipboard();
clipboard->setMimeData(mimeData, QClipboard::Clipboard);
QApplication::clipboard()->setText(txt) ;
}
void GxsCommentTreeWidget::setup(RsGxsCommentService *comment_service)