Commit e28d2c4e authored by David Faure's avatar David Faure

add_definitions(-DQT_NO_URL_CAST_FROM_STRING) + fix bugs

parent 77909322
......@@ -27,6 +27,7 @@ find_package (KF5 REQUIRED
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
add_definitions (-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
check_include_files(ieeefp.h HAVE_IEEEFP_H)
configure_file(config-kmplot.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kmplot/config-kmplot.h)
......
......@@ -154,11 +154,11 @@ void KmPlot::slotUpdateFullScreen( bool checked)
bool KmPlot::load(const QUrl& url)
{
m_part->openUrl( url );
if (m_part->url().isEmpty())
return false;
setCaption(url.toString()); // PrettyDecoded is the default
return true;
m_part->openUrl( url );
if (m_part->url().isEmpty())
return false;
setCaption(url.toDisplayString());
return true;
}
void KmPlot::setupActions()
......@@ -196,7 +196,7 @@ void KmPlot::fileOpen()
// this slot is called whenever the File->Open menu is selected,
// the Open shortcut is pressed (usually CTRL+O) or the Open toolbar
// button is clicked
QUrl const url = KFileDialog::getOpenUrl( QDir::currentPath(),
QUrl const url = KFileDialog::getOpenUrl( QUrl::fromLocalFile(QDir::currentPath()),
i18n( "*.fkt|KmPlot Files (*.fkt)\n*|All Files" ),
this, i18n( "Open" ) );
......@@ -222,7 +222,7 @@ void KmPlot::fileOpen(const QUrl &url)
// says that it should open a new window if the document is _not_
// in its initial state. This is what we do here..
if ( m_part->url().isEmpty() && !isModified() )
load( KStandardDirs::realFilePath(url.url())); // we open the file in this window...
load(url); // we open the file in this window...
else
openFileInNewWindow(url); // we open the file in a new window...
}
......
......@@ -71,9 +71,11 @@ private slots:
void cancelDraw();
public Q_SLOTS:
// DBus interface
Q_SCRIPTABLE void fileOpen();
Q_SCRIPTABLE void setStatusBarText(const QString &, int id);
// DBus interface
Q_SCRIPTABLE void fileOpen();
Q_SCRIPTABLE void fileOpen(const QString &str) { fileOpen(QUrl(str)); }
Q_SCRIPTABLE void setStatusBarText(const QString &, int id);
Q_SCRIPTABLE void openFileInNewWindow(const QString &str) { openFileInNewWindow(QUrl(str)); }
Q_SCRIPTABLE void openFileInNewWindow(const QUrl &url);
/**
* Set the progress of drawing the plots, with \p progress ranging from 0
......
......@@ -208,16 +208,16 @@ bool KParameterEditor::checkValueValid()
void KParameterEditor::cmdImport_clicked()
{
QUrl url = KFileDialog::getOpenUrl( QString(),i18n("*.txt|Plain Text File "));
QUrl url = KFileDialog::getOpenUrl(QUrl(),i18n("*.txt|Plain Text File "));
if ( url.isEmpty() )
return;
if (!KIO::NetAccess::exists(url, KIO::NetAccess::SourceSide, this) )
{
KMessageBox::sorry(0,i18n("The file does not exist."));
return;
}
bool verbose = false;
QFile file;
QString tmpfile;
......@@ -278,16 +278,16 @@ void KParameterEditor::cmdExport_clicked()
{
if ( !m_mainWidget->list->count() )
return;
QUrl url = KFileDialog::getSaveUrl( QString(),i18n("*.txt|Plain Text File "));
QUrl url = KFileDialog::getSaveUrl(QUrl(),i18n("*.txt|Plain Text File "));
if ( url.isEmpty() )
return;
if( !KIO::NetAccess::exists( url, KIO::NetAccess::DestinationSide, this ) || KMessageBox::warningContinueCancel( this, i18n( "A file named \"%1\" already exists. Are you sure you want to continue and overwrite this file?", url.url()), i18n( "Overwrite File?" ), KGuiItem( i18n( "&Overwrite" ) ) ) == KMessageBox::Continue )
if( !KIO::NetAccess::exists( url, KIO::NetAccess::DestinationSide, this ) || KMessageBox::warningContinueCancel( this, i18n( "A file named \"%1\" already exists. Are you sure you want to continue and overwrite this file?", url.toDisplayString()), i18n( "Overwrite File?" ), KGuiItem( i18n( "&Overwrite" ) ) ) == KMessageBox::Continue )
{
if ( !url.isLocalFile() )
{
KTemporaryFile tmpfile;
if (tmpfile.open() )
{
QTextStream stream(&tmpfile);
......
......@@ -513,7 +513,7 @@ void MainDlg::slotSaveas()
{
if (m_readonly)
return;
const QUrl url = KFileDialog::getSaveUrl( QDir::currentPath(),
const QUrl url = KFileDialog::getSaveUrl(QUrl::fromLocalFile(QDir::currentPath()),
i18n( "*.fkt|KmPlot Files (*.fkt)\n*|All Files" ),
m_parent, i18n( "Save As" ) );
......@@ -547,7 +547,7 @@ void MainDlg::slotExport()
QString filter = KImageIO::pattern( KImageIO::Writing );
filter += i18n("\n*.svg|Scalable Vector Graphics");
QUrl url = KFileDialog::getSaveUrl( QDir::currentPath(), filter, m_parent, i18n( "Export as Image" ) );
QUrl url = KFileDialog::getSaveUrl(QUrl::fromLocalFile(QDir::currentPath()), filter, m_parent, i18n( "Export as Image" ) );
if ( !url.isValid() )
return;
......@@ -636,8 +636,8 @@ bool MainDlg::openFile()
}
m_currentfile = url();
m_recentFiles->addUrl( QUrl(url()).toString() );
setWindowCaption( QUrl(url()).toString() );
m_recentFiles->addUrl( url() );
setWindowCaption( url().toDisplayString() );
resetUndoRedo();
View::self()->updateSliders();
View::self()->drawPlot();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment