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

@ -20,10 +20,10 @@
****************************************************************/
#include <QMessageBox>
#include <QFileDialog>
#include <QBuffer>
#include "CreateBlog.h"
#include "util/misc.h"
#include <retroshare/rsblogs.h>
@ -143,8 +143,8 @@ void CreateBlog::createBlog()
void CreateBlog::addBlogLogo(){
QString fileName = QFileDialog::getOpenFileName(this, "Load File", QDir::homePath(), "Pictures (*.png *.xpm *.jpg)");
if(!fileName.isEmpty())
QString fileName;
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_IMAGES, tr("Load File"), tr("Pictures (*.png *.xpm *.jpg)"), fileName))
{
picture = QPixmap(fileName).scaled(64,64, Qt::IgnoreAspectRatio,Qt::SmoothTransformation);

View file

@ -23,7 +23,7 @@
#include <QColorDialog>
#include <QFontComboBox>
#include <QFile>
#include <QFileDialog>
#include <QFileInfo>
#include <QPrintDialog>
#include <QPrinter>
#include <QTextCodec>
@ -35,6 +35,7 @@
#include "CreateBlogMsg.h"
#include "gui/msgs/textformat.h"
#include "util/misc.h"
#include <retroshare/rsblogs.h>
@ -803,9 +804,8 @@ void CreateBlogMsg::fileNew()
void CreateBlogMsg::fileOpen()
{
QString fn = QFileDialog::getOpenFileName(this, tr("Open File..."),
QString(), tr("HTML-Files (*.htm *.html);;All Files (*)"));
if (!fn.isEmpty())
QString fn;
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_BLOGS, tr("Open File..."), tr("HTML-Files (*.htm *.html);;All Files (*)"), fn))
load(fn);
}
@ -823,14 +823,15 @@ bool CreateBlogMsg::fileSave()
bool CreateBlogMsg::fileSaveAs()
{
QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
QString(), tr("ODF files (*.odt);;HTML-Files (*.htm *.html);;All Files (*)"));
if (fn.isEmpty())
return false;
if (! (fn.endsWith(".odt", Qt::CaseInsensitive) || fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) )
fn += ".odt"; // default
setCurrentFileName(fn);
return fileSave();
QString fn;
if (misc::getSaveFileName(this, RshareSettings::LASTDIR_BLOGS, tr("Save as..."), tr("ODF files (*.odt);;HTML-Files (*.htm *.html);;All Files (*)"), fn)) {
if (! (fn.endsWith(".odt", Qt::CaseInsensitive) || fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) )
fn += ".odt"; // default
setCurrentFileName(fn);
return fileSave();
}
return false;
}
void CreateBlogMsg::filePrint()
@ -872,9 +873,8 @@ void CreateBlogMsg::filePrintPdf()
{
#ifndef QT_NO_PRINTER
//! [0]
QString fileName = QFileDialog::getSaveFileName(this, "Export PDF",
QString(), "*.pdf");
if (!fileName.isEmpty()) {
QString fileName;
if (misc::getSaveFileName(this, RshareSettings::LASTDIR_MESSAGES, tr("Export PDF"), "*.pdf", fileName)) {
if (QFileInfo(fileName).suffix().isEmpty())
fileName.append(".pdf");
QPrinter printer(QPrinter::HighResolution);
@ -901,22 +901,14 @@ void CreateBlogMsg::setCurrentFileName(const QString &fileName)
setWindowModified(false);
}
void CreateBlogMsg::addImage()
void CreateBlogMsg::addImage()
{
QString fileimg = QFileDialog::getOpenFileName( this, tr( "Choose Image" ),
QString(setter.value("LastDir").toString()) ,tr("Image Files supported (*.png *.jpeg *.jpg *.gif)"));
QString fileimg;
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_MESSAGES, tr("Choose Image"), tr("Image Files supported (*.png *.jpeg *.jpg *.gif)"), fileimg)) {
QImage base(fileimg);
if ( fileimg.isEmpty() ) {
return;
Create_New_Image_Tag(fileimg);
}
QImage base(fileimg);
QString pathimage = fileimg.left(fileimg.lastIndexOf("/"))+"/";
setter.setValue("LastDir",pathimage);
Create_New_Image_Tag(fileimg);
}
void CreateBlogMsg::Create_New_Image_Tag( const QString urlremoteorlocal )