summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Faure <[email protected]>2016-06-25 17:41:37 +0200
committerDavid Faure <[email protected]>2016-06-25 17:41:37 +0200
commite28d2c4e9444b10ec65a7aace93abacba2291b95 (patch)
tree02fa1956ecb42148ceb5bac407cb7a1d9a5bd203
parent77909322194eeb14bbe69759059c29d884f9ecc1 (diff)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING) + fix bugsv16.08.0v16.07.90v16.07.80
-rw-r--r--CMakeLists.txt1
-rw-r--r--kmplot/kmplot.cpp14
-rw-r--r--kmplot/kmplot.h8
-rw-r--r--kmplot/kparametereditor.cpp12
-rw-r--r--kmplot/maindlg.cpp8
5 files changed, 23 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5ef1290..25f6c78 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/kmplot/kmplot.cpp b/kmplot/kmplot.cpp
index 2529137..53f7b7a 100644
--- a/kmplot/kmplot.cpp
+++ b/kmplot/kmplot.cpp
@@ -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...
}
diff --git a/kmplot/kmplot.h b/kmplot/kmplot.h
index 148ad29..97312ba 100644
--- a/kmplot/kmplot.h
+++ b/kmplot/kmplot.h
@@ -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
diff --git a/kmplot/kparametereditor.cpp b/kmplot/kparametereditor.cpp
index 904cbe6..6a0976b 100644
--- a/kmplot/kparametereditor.cpp
+++ b/kmplot/kparametereditor.cpp
@@ -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);
diff --git a/kmplot/maindlg.cpp b/kmplot/maindlg.cpp
index 888dcf0..9270ff1 100644
--- a/kmplot/maindlg.cpp
+++ b/kmplot/maindlg.cpp
@@ -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();