textedit_example.patch From: Christian Prochaska --- demos/textedit/main.cpp | 23 ++++++++++++++++++++++- demos/textedit/textedit.cpp | 8 ++++---- demos/textedit/textedit.pro | 5 ----- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/demos/textedit/main.cpp b/demos/textedit/main.cpp index 0fc0b57..4fe6bfc 100644 --- a/demos/textedit/main.cpp +++ b/demos/textedit/main.cpp @@ -39,16 +39,37 @@ ** ****************************************************************************/ +/* Genode includes */ +#include + +/* Qt4 includes */ #include "textedit.h" #include +/* disable "not implemented yet" messages */ +extern "C" void _sigprocmask() { } +extern "C" void sigprocmask() { } + int main( int argc, char ** argv ) { Q_INIT_RESOURCE(textedit); + unsigned int x = 300; + unsigned int y = 0; + unsigned int w = 700; + unsigned int h = 700; + + try { Genode::config()->xml_node().attribute("xpos").value(&x); } catch (...) { } + try { Genode::config()->xml_node().attribute("ypos").value(&y); } catch (...) { } + try { Genode::config()->xml_node().attribute("width").value(&w); } catch (...) { } + try { Genode::config()->xml_node().attribute("height").value(&h); } catch (...) { } + QApplication a( argc, argv ); TextEdit mw; - mw.resize( 700, 800 ); + + mw.move(x, y); + mw.resize(w, h); + mw.show(); return a.exec(); } diff --git a/demos/textedit/textedit.cpp b/demos/textedit/textedit.cpp index 8b179c0..4fa4b1a 100644 --- a/demos/textedit/textedit.cpp +++ b/demos/textedit/textedit.cpp @@ -463,7 +463,7 @@ void TextEdit::fileNew() void TextEdit::fileOpen() { QString fn = QFileDialog::getOpenFileName(this, tr("Open File..."), - QString(), tr("HTML-Files (*.htm *.html);;All Files (*)")); + QString("/"), tr("HTML-Files (*.htm *.html);;All Files (*)")); if (!fn.isEmpty()) load(fn); } @@ -483,11 +483,11 @@ bool TextEdit::fileSave() bool TextEdit::fileSaveAs() { QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."), - QString(), tr("ODF files (*.odt);;HTML-Files (*.htm *.html);;All Files (*)")); + QString("/"), tr("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 + if (! (fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) ) + fn += ".html"; // default setCurrentFileName(fn); return fileSave(); } diff --git a/demos/textedit/textedit.pro b/demos/textedit/textedit.pro index 9669ec8..bef1154 100644 --- a/demos/textedit/textedit.pro +++ b/demos/textedit/textedit.pro @@ -8,10 +8,6 @@ SOURCES = textedit.cpp \ main.cpp RESOURCES += textedit.qrc -build_all:!build_pass { - CONFIG -= build_all - CONFIG += release -} # install target.path = $$[QT_INSTALL_DEMOS]/textedit @@ -19,4 +15,3 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.html *.doc images sources.path = $$[QT_INSTALL_DEMOS]/textedit INSTALLS += target sources -symbian: include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)