Okay i think i have changed everything as you specified but if you find anything do let me know though.<br><br><div class="gmail_quote">On Tue, Mar 22, 2011 at 8:11 PM, Sebastian Trüg <span dir="ltr"><<a href="mailto:trueg@kde.org">trueg@kde.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Very good. But since I am a pita some more comments. :)<br>
<br>
On 03/22/2011 11:20 AM, Who Knows wrote:<br>
> diff --git a/mainwindow.cpp b/mainwindow.cpp<br>
> index d9cd450..29579ab 100644<br>
> --- a/mainwindow.cpp<br>
> +++ b/mainwindow.cpp<br>
> @@ -210,7 +210,20 @@ void MainWindow::setupActions()<br>
> // misc actions<br>
> // =============================================<br>
> KStandardAction::preferences( this, SLOT( slotSettings() ), actionCollection() );<br>
> - KStandardAction::open( this, SLOT( slotOpen() ), actionCollection() );<br>
> +<br>
> + m_actionOpenResource=KStandardAction::open( this, SLOT( slotOpen() ), actionCollection() );<br>
<br>
spaces around the "="<br>
<br>
> + m_actionOpenResource->setText(i18nc( "@action:button open a resource", "Open Resource" ));<br>
> + actionCollection()->addAction( QLatin1String( "open_resource" ), m_actionOpenResource );<br>
> +<br>
> + KStandardAction::quit( kapp, SLOT( quit() ), actionCollection() );<br>
<br>
This line is now duplicated.<br>
<br>
> + m_actionSaveQuery = KStandardAction::save( this, SLOT( slotSave() ), actionCollection() );<br>
> + m_actionSaveQuery->setText(i18nc( "@action:button save a query", "Save Query" ));<br>
> + actionCollection()->addAction( QLatin1String( "save_query" ), m_actionSaveQuery );<br>
> +<br>
> + m_actionOpenQuery= new KAction( KIcon( QLatin1String( "open-new" ) ), i18nc( "@action:button open a new query", "Open Query" ), actionCollection() );<br>
<br>
This does not open a "new query". It simply opens a query from a file.<br>
<br>
> + connect( m_actionOpenQuery, SIGNAL(triggered()), this, SLOT(slotLoad()) );<br>
> + actionCollection()->addAction( QLatin1String( "open_query" ), m_actionOpenQuery );<br>
> +<br>
> KStandardAction::quit( kapp, SLOT( quit() ), actionCollection() );<br>
><br>
> setupGUI( Keys|Save|Create );<br>
> @@ -320,6 +333,19 @@ void MainWindow::slotOpen()<br>
> }<br>
> }<br>
><br>
> +void MainWindow::slotSave()<br>
<br>
Please call it slotSaveQuery()<br>
<br>
> +{<br>
> + m_mainStack->setCurrentWidget( m_resourceQueryWidget );<br>
> + m_resourceQueryWidget->slotQuerySaveButtonClicked();<br>
> +}<br>
> +<br>
> +<br>
> +<br>
> +void MainWindow::slotLoad()<br>
<br>
please call it slotOpenQuery()<br>
<br>
> +{<br>
> + m_resourceQueryWidget->slotQueryLoadButtonClicked();<br>
> + m_mainStack->setCurrentWidget( m_resourceQueryWidget );<br>
> +}<br>
><br>
> void MainWindow::slotShowSource()<br>
> {<br>
> @@ -365,3 +391,4 @@ MainWindow* MainWindow::nepomukShellMain()<br>
> }<br>
><br>
> #include "mainwindow.moc"<br>
> +<br>
> diff --git a/mainwindow.h b/mainwindow.h<br>
> index ebf4dd5..a7d5f22 100644<br>
> --- a/mainwindow.h<br>
> +++ b/mainwindow.h<br>
> @@ -58,6 +58,8 @@ private Q_SLOTS:<br>
> void slotSettings();<br>
> void slotOpen();<br>
> void slotShowSource();<br>
> + void slotSave();<br>
> + void slotLoad();<br>
><br>
> private:<br>
> bool queryClose();<br>
> @@ -73,7 +75,11 @@ private:<br>
> KAction* m_actionNewSubClass;<br>
> KAction* m_actionNewProperty;<br>
> KAction* m_actionNewResource;<br>
> -<br>
> + KAction* m_actionOpenResource;<br>
> + KAction* m_actionSaveQuery;<br>
> + KAction* m_actionOpenQuery;<br>
> +<br>
> +<br>
> KAction* m_actionModeBrowse;<br>
> KAction* m_actionModeQuery;<br>
> KAction* m_actionModeEdit;<br>
> @@ -86,3 +92,4 @@ private:<br>
> };<br>
><br>
> #endif<br>
> +<br>
> diff --git a/nepomukshellui.rc b/nepomukshellui.rc<br>
> index e4d59c2..9fdffda 100644<br>
> --- a/nepomukshellui.rc<br>
> +++ b/nepomukshellui.rc<br>
> @@ -8,6 +8,11 @@<br>
<br>
you need to raise the version number. Otherwise KDE will not pick up the<br>
new version of the UI file and use an older local copy in the user's<br>
home dir.<br>
<br>
> <MenuBar><br>
> <Menu name="file" ><br>
> + <Action name="open_resource" /><br>
> + <Separator /><br>
> + <Action name="open_query" /><br>
> + <Action name="save_query" /><br>
> + <Separator /><br>
> <Action name="create_class" /><br>
> <Action name="create_property" /><br>
> <Action name="create_resource" /><br>
> diff --git a/resourcequerywidget.cpp b/resourcequerywidget.cpp<br>
> index 757674f..3a28c45 100644<br>
> --- a/resourcequerywidget.cpp<br>
> +++ b/resourcequerywidget.cpp<br>
> @@ -30,6 +30,7 @@<br>
> #include <KGlobal><br>
> #include <KLocale><br>
> #include <KMessageBox><br>
> +#include <KFileDialog><br>
><br>
> #include <Soprano/Node><br>
><br>
> @@ -208,5 +209,33 @@ void ResourceQueryWidget::slotQueryShortenButtonClicked()<br>
> query= query.simplified();<br>
> m_queryEdit->setPlainText( query );<br>
> }<br>
> +void ResourceQueryWidget::slotQueryLoadButtonClicked()<br>
> +{ KUrl kurl = KUrl::fromPath("/home/");<br>
<br>
Using /home as the start URL seems very random to me. I prefer using<br>
KUrl() which will make KFileDialog remember the last used folder.<br>
<br>
> + QString fileName = KFileDialog::getOpenFileName(kurl, tr("*.txt"), this, tr("Open file"));<br>
> + QFile file(fileName);<br>
> + QString line;<br>
> + if ( file.open(QIODevice::ReadOnly) ){<br>
> + QTextStream stream( &file );<br>
> + line=stream.readAll();<br>
> + file.close();<br>
> + }<br>
> + m_queryEdit->setPlainText( line );<br>
> +}<br>
> +<br>
> +void ResourceQueryWidget::slotQuerySaveButtonClicked()<br>
> +{ KUrl kurl = KUrl::fromPath("/home/");<br>
<br>
same as above.<br>
<br>
> + QString query = m_queryEdit->toPlainText();<br>
> + QString fileName = KFileDialog::getSaveFileName(kurl, tr("*.txt"),this,tr("Save File"));<br>
> + QFile file(fileName);<br>
> + if (file.open(QIODevice::WriteOnly)){<br>
> + QTextStream out(&file);<br>
> + out << query;<br>
> + file.close();<br>
> + }<br>
> +}<br>
><br>
> #include "resourcequerywidget.moc"<br>
> +<br>
> +<br>
> +<br>
> +<br>
<br>
Four trailing new lines. ;)<br>
<br>
> diff --git a/resourcequerywidget.h b/resourcequerywidget.h<br>
> index 22224fc..9d0c1d2 100644<br>
> --- a/resourcequerywidget.h<br>
> +++ b/resourcequerywidget.h<br>
> @@ -65,6 +65,10 @@ private Q_SLOTS:<br>
> void slotQueryFinished();<br>
> void slotQueryShortenButtonClicked();<br>
><br>
> +public Q_SLOTS:<br>
> + void slotQuerySaveButtonClicked();<br>
> + void slotQueryLoadButtonClicked();<br>
> +<br>
<br>
How about calling these openQuery() and saveQuery() instead since the<br>
query widget has no notion of buttons being clicked.<br>
<br>
As you can see all of my comments are mostly cosmetic. Nice work.<br>
<br>
Cheers,<br>
Sebastian<br>
<br>
> private:<br>
> void updateHistoryButtonStates();<br>
><br>
</blockquote></div><br>