Commit 5ba2200b authored by Laurent Montel's avatar Laurent Montel 😁

Allow to save result

parent 65333ca5
......@@ -17,6 +17,8 @@
#include "baloodebugdialog.h"
#include "baloodebugwidget.h"
#include "pimcommon/util/pimutil.h"
#include <QVBoxLayout>
#include <KSharedConfig>
......@@ -27,7 +29,10 @@ using namespace PimCommon;
BalooDebugDialog::BalooDebugDialog(QWidget *parent)
: KDialog(parent)
{
setButtons(Close);
setButtons(User1|Close);
//Don't translate it.
setButtonText(User1, QLatin1String("Save As..."));
connect(this, SIGNAL(user1Clicked()), this, SLOT(slotSaveAs()));
//Don't translate it's just a dialog to debug
setCaption(QLatin1String("Debug baloo"));
......@@ -74,4 +79,10 @@ void BalooDebugDialog::doSearch()
mBalooDebugWidget->doSearch();
}
void BalooDebugDialog::slotSaveAs()
{
const QString filter = QLatin1String( "*.txt|all files (*)" );
PimCommon::Util::saveTextAs(mBalooDebugWidget->plainText(), filter, this);
}
......@@ -35,6 +35,8 @@ public:
void setAkonadiId(Akonadi::Item::Id akonadiId);
void setSearchType(BalooDebugSearchPathComboBox::SearchType type);
void doSearch();
private slots:
void slotSaveAs();
private:
void readConfig();
void writeConfig();
......
......@@ -92,6 +92,11 @@ void BalooDebugWidget::doSearch()
slotSearch();
}
QString BalooDebugWidget::plainText() const
{
return QString::fromLatin1("Item: %1\n").arg(mLineEdit->text()) + mPlainTextEditor->toPlainText();
}
void BalooDebugWidget::slotSearch()
{
const QString searchId = mLineEdit->text();
......
......@@ -36,6 +36,9 @@ public:
void setAkonadiId(Akonadi::Item::Id akonadiId);
void setSearchType(BalooDebugSearchPathComboBox::SearchType type);
void doSearch();
QString plainText() const;
private Q_SLOTS:
void slotSearchLineTextChanged(const QString &text);
void slotSearch();
......
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