Added three new methods on misc: getOpenFileName, getOpenFileNames and getSaveFileName. Please use this rather than QFileDialog.

Added save and restore of the last used directories for the following types
- Extra files
- Certificates
- History
- Images
- Messages
- Blogs (not tested)
It is easy to change.

Added attach of multiple files at once in CreateForumMsg.
The RetroShare links of the added files in CreateForumMsg are added with new style and as anchor with size information.
Added translation to some file dialogs.
Removed (commented out) not needed methods in NetworkDialog.
Fixed handling of filenames with umlauts when adding extra files.


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3894 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-12-03 00:54:40 +00:00
parent c1e3947957
commit f7252fd693
23 changed files with 786 additions and 676 deletions

View file

@ -28,7 +28,6 @@
#include <QDateTime>
#include <QFontDialog>
#include <QDir>
#include <QFileDialog>
#include <QBuffer>
#include <QTextCodec>
#include <QSound>
@ -37,6 +36,7 @@
#include "PopupChatDialog.h"
#include "PopupChatWindow.h"
#include "gui/RetroShareLink.h"
#include "util/misc.h"
#include "rshare.h"
#include <retroshare/rspeers.h>
@ -889,26 +889,19 @@ void PopupChatDialog::updateAvatar()
void PopupChatDialog::addExtraFile()
{
// select a file
QString qfile = QFileDialog::getOpenFileName(this, tr("Add Extra File"), "", "", 0,
QFileDialog::DontResolveSymlinks);
std::string filePath = qfile.toStdString();
if (filePath != "")
{
addAttachment(filePath,0);
}
QString file;
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", file)) {
addAttachment(file.toUtf8().constData(), 0);
}
}
void PopupChatDialog::addExtraPicture()
{
// select a picture file
QString qfile = QFileDialog::getOpenFileName(this, "Load Picture File", QDir::homePath(), "Pictures (*.png *.xpm *.jpg)",0,
QFileDialog::DontResolveSymlinks);
std::string filePath=qfile.toStdString();
if(filePath!="")
{
PopupChatDialog::addAttachment(filePath,1); //picture
}
// select a picture file
QString file;
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_IMAGES, tr("Load Picture File"), "Pictures (*.png *.xpm *.jpg)", file)) {
addAttachment(file.toUtf8().constData(), 1);
}
}
void PopupChatDialog::addAttachment(std::string filePath,int flag)
@ -1115,12 +1108,13 @@ bool PopupChatDialog::fileSave()
bool PopupChatDialog::fileSaveAs()
{
QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
QString(), tr("Text File (*.txt );;All Files (*)"));
if (fn.isEmpty())
return false;
setCurrentFileName(fn);
return fileSave();
QString fn;
if (misc::getSaveFileName(this, RshareSettings::LASTDIR_HISTORY, tr("Save as..."), tr("Text File (*.txt );;All Files (*)"), fn)) {
setCurrentFileName(fn);
return fileSave();
}
return false;
}
void PopupChatDialog::setCurrentFileName(const QString &fileName)