summaryrefslogtreecommitdiff
path: root/src/urlbar
diff options
context:
space:
mode:
Diffstat (limited to 'src/urlbar')
-rw-r--r--src/urlbar/bookmarkwidget.cpp181
-rw-r--r--src/urlbar/bookmarkwidget.h23
-rw-r--r--src/urlbar/completionwidget.cpp8
-rw-r--r--src/urlbar/listitem.cpp4
-rw-r--r--src/urlbar/newresourcedialog.cpp133
-rw-r--r--src/urlbar/newresourcedialog.h53
-rw-r--r--src/urlbar/resourcelinkdialog.cpp388
-rw-r--r--src/urlbar/resourcelinkdialog.h51
-rw-r--r--src/urlbar/urlbar.cpp2
-rw-r--r--src/urlbar/urlbar.h2
-rw-r--r--src/urlbar/urlresolver.cpp22
11 files changed, 468 insertions, 399 deletions
diff --git a/src/urlbar/bookmarkwidget.cpp b/src/urlbar/bookmarkwidget.cpp
index d3bcd41b..2b76073e 100644
--- a/src/urlbar/bookmarkwidget.cpp
+++ b/src/urlbar/bookmarkwidget.cpp
@@ -4,6 +4,7 @@
*
* Copyright (C) 2010-2011 by Yoann Laissus <yoann dot laissus at gmail dot com>
* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (c) 2011-2012 by Phaneendra Hegde <pnh.pes@gmail.com>
*
*
* This program is free software; you can redistribute it and/or
@@ -55,11 +56,11 @@
#include "../config-nepomuk.h"
#ifdef HAVE_NEPOMUK
- // Local Nepomuk Includes
- #include "resourcelinkdialog.h"
+// Local Nepomuk Includes
+#include "resourcelinkdialog.h"
- //Nepomuk Includes
- #include <Soprano/Vocabulary/NAO>
+//Nepomuk Includes
+#include <Soprano/Vocabulary/NAO>
#endif
@@ -76,7 +77,7 @@ BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
m_isNepomukEnabled = QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.NepomukServer");
kDebug() << "IS NEPOMUK ACTUALLY RUNNING? " << m_isNepomukEnabled;
#endif
-
+
QFormLayout *layout = new QFormLayout(this);
layout->setHorizontalSpacing(20);
@@ -89,14 +90,14 @@ BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
bookmarkInfo->setFont(f);
// Remove button
- QLabel *removeLabel = new QLabel( this );
- removeLabel->setText( i18n( "<a href='Remove'>Remove</a>" ) );
- removeLabel->setAlignment( Qt::AlignRight );
+ QLabel *removeLabel = new QLabel(this);
+ removeLabel->setText(i18n("<a href='Remove'>Remove</a>"));
+ removeLabel->setAlignment(Qt::AlignRight);
hLayout->addWidget(bookmarkInfo);
hLayout->addWidget(removeLabel);
layout->addRow(hLayout);
- connect(removeLabel, SIGNAL( linkActivated(QString) ), this, SLOT( removeBookmark() ));
+ connect(removeLabel, SIGNAL(linkActivated(QString)), this, SLOT(removeBookmark()));
//Bookmark Folder
QLabel *folderLabel = new QLabel(this);
@@ -126,51 +127,51 @@ BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
if (m_isNepomukEnabled)
{
QLabel* rateLabel = new QLabel(this);
- rateLabel->setText( i18n( "Rate:" ) );
- KRatingWidget *ratingWidget = new KRatingWidget( this );
- if ( m_nfoResource.rating() != NULL )
+ rateLabel->setText(i18n("Rate:"));
+ KRatingWidget *ratingWidget = new KRatingWidget(this);
+ if (m_nfoResource.rating() != 0)
{
- ratingWidget->setRating( m_nfoResource.rating() );
+ ratingWidget->setRating(m_nfoResource.rating());
}
- connect( ratingWidget, SIGNAL( ratingChanged( int ) ), this, SLOT( setRatingSlot( int ) ) );
- ratingWidget->setToolTip( i18n( "Rate this page" ) );
- layout->addRow( rateLabel,ratingWidget );
+ connect(ratingWidget, SIGNAL(ratingChanged(int)), this, SLOT(setRatingSlot(int)));
+ ratingWidget->setToolTip(i18n("Rate this page"));
+ layout->addRow(rateLabel, ratingWidget);
//Add comments
- QLabel *commentLabel = new QLabel( this );
- commentLabel->setText( i18n( "Describe:" ) );
- commentLabel->setAlignment( Qt::AlignCenter );
- m_commentEdit = new QPlainTextEdit( this );
- if ( !m_nfoResource.description().isEmpty() )
+ QLabel *commentLabel = new QLabel(this);
+ commentLabel->setText(i18n("Describe:"));
+ commentLabel->setAlignment(Qt::AlignCenter);
+ m_commentEdit = new QPlainTextEdit(this);
+ if (!m_nfoResource.description().isEmpty())
{
- m_commentEdit->setPlainText( m_nfoResource.description() );
+ m_commentEdit->setPlainText(m_nfoResource.description());
}
- connect( m_commentEdit, SIGNAL(textChanged()), this, SLOT(addCommentSlot()) );
- layout->addRow( commentLabel, m_commentEdit );
+ connect(m_commentEdit, SIGNAL(textChanged()), this, SLOT(addCommentSlot()));
+ layout->addRow(commentLabel, m_commentEdit);
// Create tags
- QLabel *tagLabel = new QLabel( this );
- tagLabel->setText( i18n( "Tags:" ) );
- tagLabel->setAlignment( Qt::AlignLeft );
- m_tagLine = new KLineEdit( this );
- m_tagLine->setPlaceholderText( i18n( "add tags(comma separated)" ) );
+ QLabel *tagLabel = new QLabel(this);
+ tagLabel->setText(i18n("Tags:"));
+ tagLabel->setAlignment(Qt::AlignLeft);
+ m_tagLine = new KLineEdit(this);
+ m_tagLine->setPlaceholderText(i18n("add tags(comma separated)"));
QList<Nepomuk::Tag> tagList = Nepomuk::Tag::allTags();
- Q_FOREACH(Nepomuk::Tag t,tagList)
+ Q_FOREACH(Nepomuk::Tag t, tagList)
{
m_tList.append(t.label());
}
- QCompleter *completeTag = new QCompleter( m_tList );
+ QCompleter *completeTag = new QCompleter(m_tList);
completeTag->setCompletionMode(QCompleter::PopupCompletion);
m_tagLine->setCompleter(completeTag);
loadTags();
- layout->addRow(tagLabel,m_tagLine);
+ layout->addRow(tagLabel, m_tagLine);
- QPushButton *linkToResource = new QPushButton( this );
- linkToResource->setText( i18n( "Link Resources" ) );
- connect(linkToResource, SIGNAL(clicked()), this, SLOT( linkToResourceSlot() ) );
+ QPushButton *linkToResource = new QPushButton(this);
+ linkToResource->setText(i18n("Link Resources"));
+ connect(linkToResource, SIGNAL(clicked()), this, SLOT(linkToResourceSlot()));
layout->addWidget(linkToResource);
}
else
@@ -183,7 +184,7 @@ BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
layout->addWidget(nepomukLabel);
}
#endif
-
+
// Ok & Cancel buttons
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
@@ -229,7 +230,7 @@ void BookmarkWidget::accept()
parseTags();
}
#endif
-
+
close();
}
@@ -287,77 +288,77 @@ void BookmarkWidget::removeBookmark()
#ifdef HAVE_NEPOMUK
- void BookmarkWidget::addTags(QList<Nepomuk::Tag> tagList)
+void BookmarkWidget::addTags(QList<Nepomuk::Tag> tagList)
+{
+ Q_FOREACH(const Nepomuk::Tag & tag, tagList)
{
- foreach ( const Nepomuk::Tag &tag,tagList)
+ if (!m_nfoResource.tags().contains(tag))
{
- if (!m_nfoResource.tags().contains(tag))
- {
- m_nfoResource.addTag(tag);
- }
- }
- foreach ( Nepomuk::Tag tag,m_nfoResource.tags())
- {
- if (!tagList.contains(tag))
- {
- tag.remove();
- }
+ m_nfoResource.addTag(tag);
}
}
-
- void BookmarkWidget::parseTags()
+ Q_FOREACH(Nepomuk::Tag tag, m_nfoResource.tags())
{
- QList<Nepomuk::Tag> tagList;
- if(m_tagLine->text().contains(','))
- {
- QString text = m_tagLine->text();
- QStringList tagStringList = text.split( QChar::fromAscii(',') );
-
- foreach( const QString &tag, tagStringList )
- {
- QString trimmedTag = tag.trimmed();
- if (!trimmedTag.isEmpty())
- tagList << trimmedTag;
- }
- }
- else
+ if (!tagList.contains(tag))
{
- tagList << m_tagLine->text().trimmed();
+ tag.remove();
}
- addTags(tagList);
}
+}
-
- void BookmarkWidget::loadTags()
+void BookmarkWidget::parseTags()
+{
+ QList<Nepomuk::Tag> tagList;
+ if (m_tagLine->text().contains(','))
{
- QString list;
- if(!m_nfoResource.tags().isEmpty())
+ QString text = m_tagLine->text();
+ QStringList tagStringList = text.split(QChar::fromAscii(','));
+
+ Q_FOREACH(const QString & tag, tagStringList)
{
- foreach( const Nepomuk::Tag &tag, m_nfoResource.tags() )
- {
- list.append(tag.genericLabel());
- list.append(",");
- }
- m_tagLine->setText(list);
+ QString trimmedTag = tag.trimmed();
+ if (!trimmedTag.isEmpty())
+ tagList << trimmedTag;
}
}
-
-
- void BookmarkWidget::setRatingSlot( int rate )
+ else
{
- m_nfoResource.setRating(rate);
+ tagList << m_tagLine->text().trimmed();
}
+ addTags(tagList);
+}
+
-
- void BookmarkWidget::addCommentSlot()
+void BookmarkWidget::loadTags()
+{
+ QString list;
+ if (!m_nfoResource.tags().isEmpty())
{
- m_nfoResource.setDescription(m_commentEdit->toPlainText());
+ Q_FOREACH(const Nepomuk::Tag & tag, m_nfoResource.tags())
+ {
+ list.append(tag.genericLabel());
+ list.append(",");
+ }
+ m_tagLine->setText(list);
}
+}
- void BookmarkWidget::linkToResourceSlot()
- {
- Nepomuk::ResourceLinkDialog r( m_nfoResource );
- r.exec();
- }
+void BookmarkWidget::setRatingSlot(int rate)
+{
+ m_nfoResource.setRating(rate);
+}
+
+
+void BookmarkWidget::addCommentSlot()
+{
+ m_nfoResource.setDescription(m_commentEdit->toPlainText());
+}
+
+
+void BookmarkWidget::linkToResourceSlot()
+{
+ Nepomuk::ResourceLinkDialog r(m_nfoResource);
+ r.exec();
+}
#endif
diff --git a/src/urlbar/bookmarkwidget.h b/src/urlbar/bookmarkwidget.h
index 41dd344e..6dc1b761 100644
--- a/src/urlbar/bookmarkwidget.h
+++ b/src/urlbar/bookmarkwidget.h
@@ -4,6 +4,7 @@
*
* Copyright (C) 2010-2011 by Yoann Laissus <yoann dot laissus at gmail dot com>
* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (c) 2011-2012 by Phaneendra Hegde <pnh.pes@gmail.com>
*
*
* This program is free software; you can redistribute it and/or
@@ -37,10 +38,12 @@
#include "../config-nepomuk.h"
#ifdef HAVE_NEPOMUK
- // Nepomuk Includes
- #include <Nepomuk/Resource>
- #include <Nepomuk/Tag>
- #include <Nepomuk/Vocabulary/NFO>
+
+// Nepomuk Includes
+#include <Nepomuk/Resource>
+#include <Nepomuk/Tag>
+#include <Nepomuk/Vocabulary/NFO>
+
#endif
// Forward Declarations
@@ -59,28 +62,28 @@ public:
void showAt(const QPoint &pos);
-#ifdef HAVE_NEPOMUK
+#ifdef HAVE_NEPOMUK
void addTags(QList<Nepomuk::Tag>);
void parseTags();
void loadTags();
#endif
-
+
Q_SIGNALS:
void updateIcon();
private:
void setupFolderComboBox();
-
+
private Q_SLOTS:
void accept();
void removeBookmark();
#ifdef HAVE_NEPOMUK
- void setRatingSlot( int rate );
+ void setRatingSlot(int rate);
void addCommentSlot();
void linkToResourceSlot();
#endif
-
+
private:
KBookmark *m_bookmark;
KLineEdit *m_name;
@@ -89,7 +92,7 @@ private:
QPlainTextEdit *m_commentEdit;
QStringList m_tList;
-#ifdef HAVE_NEPOMUK
+#ifdef HAVE_NEPOMUK
Nepomuk::Resource m_nfoResource;
bool m_isNepomukEnabled;
#endif
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
index 92ef4fb9..fa38d7f0 100644
--- a/src/urlbar/completionwidget.cpp
+++ b/src/urlbar/completionwidget.cpp
@@ -73,9 +73,9 @@ void CompletionWidget::insertItems(const UrlSearchList &list, const QString& tex
ListItem *suggestion = ListItemFactory::create(item, text, this);
suggestion->setBackgroundRole(offset % 2 ? QPalette::AlternateBase : QPalette::Base);
connect(suggestion,
- SIGNAL(itemClicked(ListItem*,Qt::MouseButton,Qt::KeyboardModifiers)),
+ SIGNAL(itemClicked(ListItem*, Qt::MouseButton, Qt::KeyboardModifiers)),
this,
- SLOT(itemChosen(ListItem*,Qt::MouseButton,Qt::KeyboardModifiers)));
+ SLOT(itemChosen(ListItem*, Qt::MouseButton, Qt::KeyboardModifiers)));
connect(suggestion, SIGNAL(updateList()), this, SLOT(updateList()));
connect(this, SIGNAL(nextItemSubChoice()), suggestion, SLOT(nextItemSubChoice()));
@@ -384,8 +384,8 @@ void CompletionWidget::suggestUrls(const QString &text)
}
UrlResolver *res = new UrlResolver(text);
- connect(res, SIGNAL(suggestionsReady(UrlSearchList,QString)),
- this, SLOT(updateSearchList(UrlSearchList,QString)));
+ connect(res, SIGNAL(suggestionsReady(UrlSearchList, QString)),
+ this, SLOT(updateSearchList(UrlSearchList, QString)));
_resList = res->orderedSearchItems();
// NOTE: It's important to call this AFTER orderedSearchItems() to let everything work
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
index 92552e7e..8b753569 100644
--- a/src/urlbar/listitem.cpp
+++ b/src/urlbar/listitem.cpp
@@ -391,8 +391,8 @@ ImageLabel::ImageLabel(const QString &url, int width, int height, QWidget *paren
else
{
KIO::TransferJob *job = KIO::get(KUrl(url), KIO::NoReload, KIO::HideProgressInfo);
- connect(job, SIGNAL(data(KIO::Job*,QByteArray)),
- this, SLOT(slotData(KJob*,QByteArray)));
+ connect(job, SIGNAL(data(KIO::Job*, QByteArray)),
+ this, SLOT(slotData(KJob*, QByteArray)));
connect(job, SIGNAL(result(KJob*)),
this, SLOT(slotResult(KJob*)));
}
diff --git a/src/urlbar/newresourcedialog.cpp b/src/urlbar/newresourcedialog.cpp
index 9e0ed223..39cffc36 100644
--- a/src/urlbar/newresourcedialog.cpp
+++ b/src/urlbar/newresourcedialog.cpp
@@ -1,37 +1,45 @@
-/*
- This is a part of the GSoC project - Fancy Bookmarking
- Copyright 2011 Phaneendra Hegde <pnh.pes@gmail.com>
+/* ============================================================
+*
+* This is a part of the GSoC project 2011 - Fancy Bookmarking
+*
+* Copyright (c) 2011-2012 by Phaneendra Hegde <pnh.pes@gmail.com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published by
- the Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
- This library is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
- License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-*/
-
-//Local Includes
+// Self Includes
#include "newresourcedialog.h"
+#include "newresourcedialog.moc"
-//Nepomuk Includes
+// Nepomuk Includes
#include <Nepomuk/Vocabulary/NCO>
#include <Nepomuk/Vocabulary/PIMO>
#include <Nepomuk/Resource>
#include <Nepomuk/Tag>
-//Qt Includes
+// Qt Includes
#include <QPlainTextEdit>
#include <QVBoxLayout>
#include <QLabel>
+
class Nepomuk::NewResourceDialog::Private
{
public:
@@ -45,30 +53,30 @@ public:
};
-Nepomuk::NewResourceDialog::NewResourceDialog( int index, Nepomuk::Resource& nfoResource, QWidget* parent ):
- KDialog( parent ),
- d( new Private() )
+Nepomuk::NewResourceDialog::NewResourceDialog(int index, Nepomuk::Resource& nfoResource, QWidget* parent):
+ KDialog(parent),
+ d(new Private())
{
d->q = this;
d->m_index = index;
- d->m_nofResource =nfoResource;
- setWindowTitle( i18n( "Link to new Resource" ) );
- setButtonText( Ok, i18n( "Link" ) );
- setMinimumSize( 200, 150 );
+ d->m_nofResource = nfoResource;
+ setWindowTitle(i18n("Link to new Resource"));
+ setButtonText(Ok, i18n("Link"));
+ setMinimumSize(200, 150);
- QVBoxLayout *layout = new QVBoxLayout( mainWidget() );
- d->m_resourceName = new KLineEdit( mainWidget() );
- d->m_titleResource = new QLabel( mainWidget() );
- d->m_titleResource->setText( i18n( "* Resource Name:" ) );
- layout->addWidget( d->m_titleResource );
- layout->addWidget( d->m_resourceName );
- d->m_description = new QPlainTextEdit( mainWidget() );
- d->m_desResource = new QLabel( mainWidget() );
- d->m_desResource->setText( i18n( "Description (Optional)" ));
- layout->addWidget( d->m_desResource);
- layout->addWidget( d->m_description );
+ QVBoxLayout *layout = new QVBoxLayout(mainWidget());
+ d->m_resourceName = new KLineEdit(mainWidget());
+ d->m_titleResource = new QLabel(mainWidget());
+ d->m_titleResource->setText(i18n("* Resource Name:"));
+ layout->addWidget(d->m_titleResource);
+ layout->addWidget(d->m_resourceName);
+ d->m_description = new QPlainTextEdit(mainWidget());
+ d->m_desResource = new QLabel(mainWidget());
+ d->m_desResource->setText(i18n("Description (Optional)"));
+ layout->addWidget(d->m_desResource);
+ layout->addWidget(d->m_description);
- connect( this, SIGNAL( okClicked() ), this, SLOT( newResourceSlot() ) );
+ connect(this, SIGNAL(okClicked()), this, SLOT(newResourceSlot()));
}
@@ -80,29 +88,34 @@ Nepomuk::NewResourceDialog::~NewResourceDialog()
void Nepomuk::NewResourceDialog::newResourceSlot()
{
- if( d->m_index == 1 ) {
- Nepomuk::Resource newResource( d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Person() );
- newResource.addSymbol( "user-identity" );
- d->m_nofResource.addIsRelated( newResource );
+ if (d->m_index == 1)
+ {
+ Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Person());
+ newResource.addSymbol("user-identity");
+ d->m_nofResource.addIsRelated(newResource);
}
- else if( d->m_index == 2 ) {
- Nepomuk::Resource newResource( d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Project() );
- newResource.addSymbol( "project-development" );
- d->m_nofResource.addIsRelated( newResource );
+ else if (d->m_index == 2)
+ {
+ Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Project());
+ newResource.addSymbol("project-development");
+ d->m_nofResource.addIsRelated(newResource);
}
- else if( d->m_index == 3 ) {
- Nepomuk::Resource newResource( d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Task() );
- newResource.addSymbol( "view-pim-tasks" );
- d->m_nofResource.addIsRelated( newResource );
+ else if (d->m_index == 3)
+ {
+ Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Task());
+ newResource.addSymbol("view-pim-tasks");
+ d->m_nofResource.addIsRelated(newResource);
}
- else if( d->m_index == 4 ) {
- Nepomuk::Resource newResource( d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Location() );
- newResource.addSymbol( "user-location" );
- d->m_nofResource.addIsRelated( newResource );
+ else if (d->m_index == 4)
+ {
+ Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Location());
+ newResource.addSymbol("user-location");
+ d->m_nofResource.addIsRelated(newResource);
}
- else if( d->m_index == 5 ) {
- Nepomuk::Resource newResource( d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Note() );
- newResource.addSymbol( "knotes" );
- d->m_nofResource.addIsRelated( newResource );
+ else if (d->m_index == 5)
+ {
+ Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Note());
+ newResource.addSymbol("knotes");
+ d->m_nofResource.addIsRelated(newResource);
}
}
diff --git a/src/urlbar/newresourcedialog.h b/src/urlbar/newresourcedialog.h
index 0bfcd0ba..f8aa5f48 100644
--- a/src/urlbar/newresourcedialog.h
+++ b/src/urlbar/newresourcedialog.h
@@ -1,32 +1,40 @@
-/*
- This is a part of the GSoC project - Fancy Bookmarking
- Copyright 2011 Phaneendra Hegde <pnh.pes@gmail.com>
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published by
- the Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- This library is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
- License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-*/
+/* ============================================================
+*
+* This is a part of the GSoC project 2011 - Fancy Bookmarking
+*
+* Copyright (c) 2011-2012 by Phaneendra Hegde <pnh.pes@gmail.com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
#ifndef NEWRESOURCEDIALOG_H
#define NEWRESOURCEDIALOG_H
-//kde includes
+
+// KDE Includes
#include <KDialog>
#include <KLineEdit>
#include <Nepomuk/Resource>
+
namespace Nepomuk
{
class NewResourceDialog : public KDialog
@@ -34,17 +42,16 @@ namespace Nepomuk
Q_OBJECT
public:
- explicit NewResourceDialog( int index,Nepomuk::Resource& nfoResource, QWidget* parent = 0 );
+ explicit NewResourceDialog(int index, Nepomuk::Resource& nfoResource, QWidget* parent = 0);
virtual ~NewResourceDialog();
private Q_SLOTS:
- void newResourceSlot();
+ void newResourceSlot();
private:
class Private;
Private* const d;
};
-
}
#endif // NEWRESOURCEDIALOG_H
diff --git a/src/urlbar/resourcelinkdialog.cpp b/src/urlbar/resourcelinkdialog.cpp
index 9c2ab203..8a4b5685 100644
--- a/src/urlbar/resourcelinkdialog.cpp
+++ b/src/urlbar/resourcelinkdialog.cpp
@@ -1,32 +1,41 @@
-/*
- This is a part of the GSoC project - Fancy Bookmarking
- Copyright 2011 Phaneendra Hegde <pnh.pes@gmail.com>
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published by
- the Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- This library is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
- License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-*/
-
-//Local Includes
+/* ============================================================
+*
+* This is a part of the GSoC project 2011 - Fancy Bookmarking
+*
+* Copyright (c) 2011-2012 by Phaneendra Hegde <pnh.pes@gmail.com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+// Self Includes
#include "resourcelinkdialog.h"
+#include "resourcelinkdialog.moc"
+
+// Local Includes
#include "newresourcedialog.h"
-//Qt Includes
-#include <QtGui/QGridLayout>
-#include <QtGui/QHBoxLayout>
-#include <QtGui/QComboBox>
-#include <QtGui/QAbstractItemView>
+// Qt Includes
+#include <QGridLayout>
+#include <QHBoxLayout>
+#include <QComboBox>
+#include <QAbstractItemView>
#include <QLabel>
#include <QListView>
#include <QPushButton>
@@ -38,13 +47,13 @@
#include <QMenu>
#include <QListWidget>
-//KDE Includes
+// KDE Includes
#include <KLocale>
#include <KDebug>
#include <KAction>
#include <KIcon>
-//Nepomuk Includes
+// Nepomuk Includes
#include <Nepomuk/Utils/SimpleResourceModel>
#include <Nepomuk/Query/Term>
#include <Nepomuk/Query/Result>
@@ -79,101 +88,106 @@ public:
};
+
void Nepomuk::ResourceLinkDialog::Private::_k_selectionChanged()
{
- q->enableButton( KDialog::User1, !m_resourceView->selectionModel()->selectedRows().isEmpty() );
+ q->enableButton(KDialog::User1, !m_resourceView->selectionModel()->selectedRows().isEmpty());
}
-Nepomuk::ResourceLinkDialog::ResourceLinkDialog( Nepomuk::Resource &nfoResource, QWidget* parent ):
- KDialog( parent ),
- d( new Private() )
+Nepomuk::ResourceLinkDialog::ResourceLinkDialog(Nepomuk::Resource &nfoResource, QWidget* parent):
+ KDialog(parent),
+ d(new Private())
{
d->m_nfoResource = nfoResource;
- setWindowTitle( i18n( "Resource Linker" ) );
- setButtons( Ok | User1 | User2 | Cancel );
- enableButtonCancel( true );
- enableButtonOk( true );
- enableButton( User1, false );
- setButtonText( Ok, i18n( "Done" ) );
- setButtonText( User1, i18n( "Link" ) );
- setButtonText( User2, "Unlink" );
- setMinimumSize(400,350);
+ setWindowTitle(i18n("Resource Linker"));
+ setButtons(Ok | User1 | User2 | Cancel);
+ enableButtonCancel(true);
+ enableButtonOk(true);
+ enableButton(User1, false);
+ setButtonText(Ok, i18n("Done"));
+ setButtonText(User1, i18n("Link"));
+ setButtonText(User2, "Unlink");
+ setMinimumSize(400, 350);
// d->m_resourceView->setSelectionMode(QAbstractItemView::ExtendedSelection);
- QGridLayout *mainLayout = new QGridLayout ( mainWidget() );
+ QGridLayout *mainLayout = new QGridLayout(mainWidget());
d->q = this;
- d->m_linkedResources = new QListView ( mainWidget() );
- d->m_linkedResourceModel = new Utils::SimpleResourceModel( this );
- d->m_linkedResources->setModel( d->m_linkedResourceModel );
+ d->m_linkedResources = new QListView(mainWidget());
+ d->m_linkedResourceModel = new Utils::SimpleResourceModel(this);
+ d->m_linkedResources->setModel(d->m_linkedResourceModel);
setRelatedResources();
- d->m_searchBox = new KLineEdit ( mainWidget() );
- d->m_searchBox->setPlaceholderText( i18n( "Search resources" ) );
- connect( d->m_searchBox, SIGNAL( textChanged( QString ) ), this, SLOT( dynamicSearchingSlot() ) );
+ d->m_searchBox = new KLineEdit(mainWidget());
+ d->m_searchBox->setPlaceholderText(i18n("Search resources"));
+ connect(d->m_searchBox, SIGNAL(textChanged(QString)), this, SLOT(dynamicSearchingSlot()));
- d->m_resourceView = new QListView ( mainWidget() );
- d->m_resourceView->setToolTip( i18n( " Double click to link resource ") );
- d->m_resourceModel = new Utils::SimpleResourceModel( this );
- d->m_resourceView->setModel( d->m_resourceModel );
+ d->m_resourceView = new QListView(mainWidget());
+ d->m_resourceView->setToolTip(i18n(" Double click to link resource "));
+ d->m_resourceModel = new Utils::SimpleResourceModel(this);
+ d->m_resourceView->setModel(d->m_resourceModel);
- d->m_resourceSelect = new QComboBox( mainWidget() );
+ d->m_resourceSelect = new QComboBox(mainWidget());
QStringList rlist;
- rlist << i18n( "Any resource" ) << i18n( "Persons" ) << i18n( "Projects" ) << i18n( "Tasks" ) << i18n( "Places" ) << i18n( "Notes" );
- d->m_resourceSelect->addItems( rlist );
- d->m_resourceSelect->setItemIcon(1,KIcon("user-identity"));
- d->m_resourceSelect->setItemIcon(2,KIcon("project-development"));
- d->m_resourceSelect->setItemIcon(3,KIcon("view-pim-tasks"));
- d->m_resourceSelect->setItemIcon(4,KIcon("user-location"));
- d->m_resourceSelect->setItemIcon(5,KIcon("knotes"));
- connect( d->m_resourceSelect, SIGNAL( currentIndexChanged( int ) ), this, SLOT( resourceSelectedSlot( int ) ) );
-
- d->m_resourceLabel = new QLabel( i18n( "Matching resources:" ), mainWidget() );
- d->m_linkedResourceLabel = new QLabel( i18n( "Linked Resources:" ), mainWidget() );
-
-
- d->m_newResourceButton = new QPushButton( mainWidget() );
- d->m_newResourceButton->setText( i18n( "Create New Resource" ) );
- if( d->m_resourceSelect->currentIndex() == 0 ) {
- d->m_newResourceButton->setEnabled( false );
+ rlist << i18n("Any resource") << i18n("Persons") << i18n("Projects") << i18n("Tasks") << i18n("Places") << i18n("Notes");
+ d->m_resourceSelect->addItems(rlist);
+ d->m_resourceSelect->setItemIcon(1, KIcon("user-identity"));
+ d->m_resourceSelect->setItemIcon(2, KIcon("project-development"));
+ d->m_resourceSelect->setItemIcon(3, KIcon("view-pim-tasks"));
+ d->m_resourceSelect->setItemIcon(4, KIcon("user-location"));
+ d->m_resourceSelect->setItemIcon(5, KIcon("knotes"));
+ connect(d->m_resourceSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(resourceSelectedSlot(int)));
+
+ d->m_resourceLabel = new QLabel(i18n("Matching resources:"), mainWidget());
+ d->m_linkedResourceLabel = new QLabel(i18n("Linked Resources:"), mainWidget());
+
+
+ d->m_newResourceButton = new QPushButton(mainWidget());
+ d->m_newResourceButton->setText(i18n("Create New Resource"));
+ if (d->m_resourceSelect->currentIndex() == 0)
+ {
+ d->m_newResourceButton->setEnabled(false);
}
- connect(d->m_newResourceButton, SIGNAL( clicked() ), this, SLOT( createNewResourceSlot() ) );
+ connect(d->m_newResourceButton, SIGNAL(clicked()), this, SLOT(createNewResourceSlot()));
QVBoxLayout *vlayoutR = new QVBoxLayout;
QVBoxLayout *vlayoutL = new QVBoxLayout;
- vlayoutL->addWidget( d->m_searchBox );
- vlayoutL->addWidget( d->m_resourceLabel );
- vlayoutL->addWidget( d->m_resourceView );
- vlayoutR->addWidget( d->m_resourceSelect );
- vlayoutR->addWidget( d->m_linkedResourceLabel );
- vlayoutR->addWidget( d->m_linkedResources );
- vlayoutR->addWidget( d->m_newResourceButton );
- mainLayout->addLayout( vlayoutL, 1 ,1 );
+ vlayoutL->addWidget(d->m_searchBox);
+ vlayoutL->addWidget(d->m_resourceLabel);
+ vlayoutL->addWidget(d->m_resourceView);
+ vlayoutR->addWidget(d->m_resourceSelect);
+ vlayoutR->addWidget(d->m_linkedResourceLabel);
+ vlayoutR->addWidget(d->m_linkedResources);
+ vlayoutR->addWidget(d->m_newResourceButton);
+ mainLayout->addLayout(vlayoutL, 1 , 1);
mainLayout->addLayout(vlayoutR, 1, 2);
- mainLayout->setColumnMinimumWidth(1,100);
+ mainLayout->setColumnMinimumWidth(1, 100);
-// d->m_linkedResources->setContextMenuPolicy(Qt::CustomContextMenu);
d->m_linkedResources->setContextMenuPolicy(Qt::CustomContextMenu);
- connect( d->m_resourceView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
- this, SLOT(_k_selectionChanged()) );
- connect ( d->m_linkedResources->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ),
- this, SLOT( _k_selectionChanged() ) );
- connect ( this, SIGNAL( user1Clicked() ), this, SLOT( linkResourceSlot() ) );
- connect ( this, SIGNAL( user2Clicked() ), this, SLOT( unlinkResourceSlot() ) );
- connect ( d->m_resourceView, SIGNAL( doubleClicked(QModelIndex) ), this, SLOT( linkResourceSlot() ) );
- connect (d->m_linkedResources, SIGNAL( customContextMenuRequested(QPoint) ), this, SLOT( showContextMenu(QPoint) ) );
- if( !d->m_linkedResources->selectionModel()->selectedRows().isEmpty() ) {
- enableButton( User2, true );
+ connect(d->m_resourceView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
+ this, SLOT(_k_selectionChanged()));
+ connect(d->m_linkedResources->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
+ this, SLOT(_k_selectionChanged()));
+ connect(this, SIGNAL(user1Clicked()), this, SLOT(linkResourceSlot()));
+ connect(this, SIGNAL(user2Clicked()), this, SLOT(unlinkResourceSlot()));
+ connect(d->m_resourceView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(linkResourceSlot()));
+ connect(d->m_linkedResources, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
+
+ if (!d->m_linkedResources->selectionModel()->selectedRows().isEmpty())
+ {
+ enableButton(User2, true);
}
}
+
Nepomuk::ResourceLinkDialog::~ResourceLinkDialog()
{
delete d;
}
+
void Nepomuk::ResourceLinkDialog::setRelatedResources()
{
QList<Nepomuk::Resource> relatedResourceList = d->m_nfoResource.isRelateds();
@@ -181,167 +195,191 @@ void Nepomuk::ResourceLinkDialog::setRelatedResources()
}
+
void Nepomuk::ResourceLinkDialog::linkResourceSlot()
{
QModelIndexList selectedResourceList;
selectedResourceList << d->m_resourceView->selectionModel()->selectedIndexes();
- Q_FOREACH(const QModelIndex& i, selectedResourceList) {
- d->m_resourceView->selectionModel()->setCurrentIndex( i, QItemSelectionModel::NoUpdate );
- d->m_nfoResource.addIsRelated( d->m_resourceModel->resourceForIndex(d->m_resourceView->selectionModel()->currentIndex() ) );
+ Q_FOREACH(const QModelIndex & i, selectedResourceList)
+ {
+ d->m_resourceView->selectionModel()->setCurrentIndex(i, QItemSelectionModel::NoUpdate);
+ d->m_nfoResource.addIsRelated(d->m_resourceModel->resourceForIndex(d->m_resourceView->selectionModel()->currentIndex()));
}
setRelatedResources();
}
+
void Nepomuk::ResourceLinkDialog::unlinkResourceSlot()
{
- d->m_nfoResource.removeProperty( Nepomuk::Resource::isRelatedUri(),
+ d->m_nfoResource.removeProperty(Nepomuk::Resource::isRelatedUri(),
d->m_linkedResourceModel->resourceForIndex(
- d->m_linkedResources->selectionModel()->currentIndex() ) );
+ d->m_linkedResources->selectionModel()->currentIndex()));
setRelatedResources();
}
+
void Nepomuk::ResourceLinkDialog::showContextMenu(const QPoint &pos)
{
d->m_removeResourceAction = new KAction(this);
d->m_removeResourceAction->setText(i18n("&Unlink "));
d->m_removeResourceAction->setIcon(KIcon("edit-delete"));
- connect (d->m_removeResourceAction, SIGNAL( triggered(bool) ), this, SLOT( unlinkResourceSlot() ) );
+ connect(d->m_removeResourceAction, SIGNAL(triggered(bool)), this, SLOT(unlinkResourceSlot()));
QMenu myMenu;
QPoint globalPos = d->m_linkedResources->mapToGlobal(pos);
myMenu.addAction(d->m_removeResourceAction);
myMenu.exec(globalPos);
}
+
+
void Nepomuk::ResourceLinkDialog::createNewResourceSlot()
{
- Nepomuk::NewResourceDialog newResource( d->m_resourceSelect->currentIndex(), d->m_nfoResource );
+ Nepomuk::NewResourceDialog newResource(d->m_resourceSelect->currentIndex(), d->m_nfoResource);
//close();
newResource.exec();
setRelatedResources();
}
+
+
void Nepomuk::ResourceLinkDialog::dynamicSearchingSlot()
{
Nepomuk::Query::Query query;
Nepomuk::Query::QueryServiceClient *test;
- switch( d->m_resourceSelect->currentIndex() ) {
+ switch (d->m_resourceSelect->currentIndex())
+ {
case 1:
- query = Nepomuk::Query::QueryParser::parseQuery( d->m_searchBox->text() );
- query = query && Nepomuk::Query::ResourceTypeTerm( Nepomuk::Vocabulary::PIMO::Person() );
- test = new Nepomuk::Query::QueryServiceClient( this );
- test->query( query );
+ query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
+ query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Person());
+ test = new Nepomuk::Query::QueryServiceClient(this);
+ test->query(query);
d->m_resourceModel->clear();
- connect(test,SIGNAL( newEntries( QList<Nepomuk::Query::Result> ) ),
- d->m_resourceModel,SLOT( addResults(QList<Nepomuk::Query::Result>)) );
+ connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
+ d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
break;
+
case 2:
- query = Nepomuk::Query::QueryParser::parseQuery( d->m_searchBox->text() );
- query = query && Nepomuk::Query::ResourceTypeTerm( Nepomuk::Vocabulary::PIMO::Project() );
- test = new Nepomuk::Query::QueryServiceClient( this );
- test->query( query );
+ query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
+ query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Project());
+ test = new Nepomuk::Query::QueryServiceClient(this);
+ test->query(query);
d->m_resourceModel->clear();
- connect(test,SIGNAL( newEntries( QList<Nepomuk::Query::Result> ) ),
- d->m_resourceModel,SLOT( addResults(QList<Nepomuk::Query::Result>)) );
+ connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
+ d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
break;
+
case 3:
- query = Nepomuk::Query::QueryParser::parseQuery( d->m_searchBox->text() );
- query = query && Nepomuk::Query::ResourceTypeTerm( Nepomuk::Vocabulary::PIMO::Task() );
- test = new Nepomuk::Query::QueryServiceClient( this );
- test->query( query );
- d->m_resourceModel->clear();
- connect(test,SIGNAL( newEntries( QList<Nepomuk::Query::Result> ) ),
- d->m_resourceModel,SLOT( addResults(QList<Nepomuk::Query::Result>)) );
- break;
+ query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
+ query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Task());
+ test = new Nepomuk::Query::QueryServiceClient(this);
+ test->query(query);
+ d->m_resourceModel->clear();
+ connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
+ d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
+ break;
+
case 4:
- query = Nepomuk::Query::QueryParser::parseQuery( d->m_searchBox->text() );
- query = query && Nepomuk::Query::ResourceTypeTerm( Nepomuk::Vocabulary::PIMO::Location() );
- test = new Nepomuk::Query::QueryServiceClient( this );
- test->query( query );
- d->m_resourceModel->clear();
- connect(test,SIGNAL( newEntries( QList<Nepomuk::Query::Result> ) ),
- d->m_resourceModel,SLOT( addResults(QList<Nepomuk::Query::Result>)) );
- break;
+ query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
+ query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Location());
+ test = new Nepomuk::Query::QueryServiceClient(this);
+ test->query(query);
+ d->m_resourceModel->clear();
+ connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
+ d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
+ break;
+
case 5:
- query = Nepomuk::Query::QueryParser::parseQuery( d->m_searchBox->text() );
- query = query && Nepomuk::Query::ResourceTypeTerm( Nepomuk::Vocabulary::PIMO::Note() );
- test = new Nepomuk::Query::QueryServiceClient( this );
- test->query( query );
+ query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
+ query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Note());
+ test = new Nepomuk::Query::QueryServiceClient(this);
+ test->query(query);
d->m_resourceModel->clear();
- connect(test,SIGNAL( newEntries( QList<Nepomuk::Query::Result> ) ),
- d->m_resourceModel,SLOT( addResults(QList<Nepomuk::Query::Result>)) );
+ connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
+ d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
break;
+
default:
break;
}
}
-void Nepomuk::ResourceLinkDialog::resourceSelectedSlot( int index )
+void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index)
{
- enableButton( User1, true );
- d->m_newResourceButton->setEnabled( true );
- if( index == 0 ) {
+ enableButton(User1, true);
+ d->m_newResourceButton->setEnabled(true);
+ if (index == 0)
+ {
d->m_resourceModel->clear();
- d->m_newResourceButton->setEnabled( false );
+ d->m_newResourceButton->setEnabled(false);
}
//List Personal Contacts
- if( index == 1 ) {
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm( Nepomuk::Vocabulary::PIMO::Person() );
- Nepomuk::Query::Query query( term );
- query.setLimit( 20 );
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery( query );
+ if (index == 1)
+ {
+ Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Person());
+ Nepomuk::Query::Query query(term);
+ query.setLimit(20);
+ QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
QList <Nepomuk::Resource> resource;
- Q_FOREACH( const Nepomuk::Query::Result& result, results ) {
- resource.append( result.resource() );
+ Q_FOREACH(const Nepomuk::Query::Result & result, results)
+ {
+ resource.append(result.resource());
}
- d->m_resourceModel->setResources( resource );
+ d->m_resourceModel->setResources(resource);
}
//List Projects
- else if( index == 2 ) {
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm( Nepomuk::Vocabulary::PIMO::Project() );
- Nepomuk::Query::Query query( term );
+ else if (index == 2)
+ {
+ Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Project());
+ Nepomuk::Query::Query query(term);
query.setLimit(20);
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery( query );
+ QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
QList <Nepomuk::Resource> resource;
- Q_FOREACH( const Nepomuk::Query::Result& result, results ) {
- resource.append( result.resource() );
+ Q_FOREACH(const Nepomuk::Query::Result & result, results)
+ {
+ resource.append(result.resource());
}
- d->m_resourceModel->setResources( resource );
+ d->m_resourceModel->setResources(resource);
}
//List Tasks
- else if( index == 3 ) {
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm( Nepomuk::Vocabulary::PIMO::Task() );
- Nepomuk::Query::Query query( term );
+ else if (index == 3)
+ {
+ Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Task());
+ Nepomuk::Query::Query query(term);
query.setLimit(20);
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery( query );
+ QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
QList <Nepomuk::Resource> resource;
- Q_FOREACH( const Nepomuk::Query::Result& result, results ) {
- resource.append( result.resource() );
+ Q_FOREACH(const Nepomuk::Query::Result & result, results)
+ {
+ resource.append(result.resource());
}
- d->m_resourceModel->setResources( resource );
+ d->m_resourceModel->setResources(resource);
}
//List Places
- else if( index == 4 ) {
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm( Nepomuk::Vocabulary::PIMO::Location() );
- Nepomuk::Query::Query query( term );
+ else if (index == 4)
+ {
+ Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Location());
+ Nepomuk::Query::Query query(term);
query.setLimit(20);
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery( query );
+ QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
QList <Nepomuk::Resource> resource;
- Q_FOREACH( const Nepomuk::Query::Result& result, results ) {
- resource.append( result.resource() );
+ Q_FOREACH(const Nepomuk::Query::Result & result, results)
+ {
+ resource.append(result.resource());
}
- d->m_resourceModel->setResources( resource );
+ d->m_resourceModel->setResources(resource);
}
//List Notes
- else if( index == 5 ) {
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm( Nepomuk::Vocabulary::PIMO::Note() );
- Nepomuk::Query::Query query( term );
+ else if (index == 5)
+ {
+ Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Note());
+ Nepomuk::Query::Query query(term);
query.setLimit(20);
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery( query );
+ QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
QList <Nepomuk::Resource> resource;
- Q_FOREACH( const Nepomuk::Query::Result& result, results ) {
- resource.append( result.resource() );
+ Q_FOREACH(const Nepomuk::Query::Result & result, results)
+ {
+ resource.append(result.resource());
}
- d->m_resourceModel->setResources( resource );
+ d->m_resourceModel->setResources(resource);
}
}
-
diff --git a/src/urlbar/resourcelinkdialog.h b/src/urlbar/resourcelinkdialog.h
index 7e623778..8846d0a0 100644
--- a/src/urlbar/resourcelinkdialog.h
+++ b/src/urlbar/resourcelinkdialog.h
@@ -1,22 +1,27 @@
-/*
- This is a part of the GSoC project - Fancy Bookmarking
- Copyright 2011 Phaneendra Hegde <pnh.pes@gmail.com>
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published by
- the Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- This library is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
- License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-*/
+/* ============================================================
+*
+* This is a part of the GSoC project 2011 - Fancy Bookmarking
+*
+* Copyright (c) 2011-2012 by Phaneendra Hegde <pnh.pes@gmail.com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
#ifndef RESOURCELINKDIALOG_H
@@ -30,10 +35,13 @@
#include <KLineEdit>
#include <KConfigDialog>
+
namespace Nepomuk
{
class Resource;
- namespace Query {
+
+ namespace Query
+ {
class Query;
}
@@ -42,7 +50,7 @@ namespace Nepomuk
Q_OBJECT
public:
- explicit ResourceLinkDialog( Nepomuk::Resource& nfoResource, QWidget* parent = 0 );
+ explicit ResourceLinkDialog(Nepomuk::Resource& nfoResource, QWidget* parent = 0);
virtual ~ResourceLinkDialog();
void setRelatedResources();
@@ -60,7 +68,6 @@ namespace Nepomuk
Private* const d;
};
-
}
#endif // RESOURCELINKDIALOG_H
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 1a8410a3..b5f05024 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -432,7 +432,7 @@ void UrlBar::activateSuggestions(bool b)
{
_box = new CompletionWidget(this);
installEventFilter(_box.data());
- connect(_box.data(), SIGNAL(chosenUrl(KUrl,Rekonq::OpenType)), this, SLOT(loadRequestedUrl(KUrl,Rekonq::OpenType)));
+ connect(_box.data(), SIGNAL(chosenUrl(KUrl, Rekonq::OpenType)), this, SLOT(loadRequestedUrl(KUrl, Rekonq::OpenType)));
// activate suggestions on edit text
connect(this, SIGNAL(textChanged(QString)), this, SLOT(detectTypedString(QString)));
diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h
index 6460dae3..4f2586bc 100644
--- a/src/urlbar/urlbar.h
+++ b/src/urlbar/urlbar.h
@@ -108,7 +108,7 @@ private Q_SLOTS:
void manageBookmarks(QPoint);
void manageFavorites(QPoint);
-
+
void refreshFavicon();
void pasteAndGo();
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp
index f7fb27f1..e2ca32cb 100644
--- a/src/urlbar/urlresolver.cpp
+++ b/src/urlbar/urlresolver.cpp
@@ -122,19 +122,19 @@ UrlSearchList UrlResolver::orderedSearchItems()
{
QStringList aboutUrlList;
aboutUrlList
- << QL1S("about:home")
- << QL1S("about:favorites")
- << QL1S("about:closedTabs")
- << QL1S("about:bookmarks")
- << QL1S("about:history")
- << QL1S("about:downloads")
- << QL1S("about:tabs")
- << QL1S("about:info");
+ << QL1S("about:home")
+ << QL1S("about:favorites")
+ << QL1S("about:closedTabs")
+ << QL1S("about:bookmarks")
+ << QL1S("about:history")
+ << QL1S("about:downloads")
+ << QL1S("about:tabs")
+ << QL1S("about:info");
QStringList aboutUrlResults = aboutUrlList.filter(_typedString, Qt::CaseInsensitive);
UrlSearchList list;
-
+
if (aboutUrlResults.isEmpty())
{
UrlSearchItem info(UrlSearchItem::Browse, QL1S("about:info"), QL1S("info"));
@@ -146,7 +146,7 @@ UrlSearchList UrlResolver::orderedSearchItems()
Q_FOREACH(const QString & urlResult, aboutUrlResults)
{
QString name = urlResult;
- name.remove(0,6);
+ name.remove(0, 6);
UrlSearchItem item(UrlSearchItem::Browse, urlResult, name);
list << item;
}
@@ -273,7 +273,7 @@ void UrlResolver::computeQurlFromUserInput()
QString hst = urlFromUserInput.host();
urlFromUserInput.setHost(hst.toLower());
}
-
+
QString urlString = urlFromUserInput.toString();
QString gTitle = i18nc("Browse a website", "Browse");
UrlSearchItem gItem(UrlSearchItem::Browse, urlString, gTitle);