finish off bookmarkinfo functionality, adds one string

commented out various pieces of pointless debug info
use new dcop signal in kbookmarkmanager to signal bookmark config changes
added setNodeText minor refactor of NodeEditCommand::execute
use listview->setSelected(item, bool) rather than item->setSelected(bool)
various minor logic cleanups to help listview bug fixing
fix possible crash in updateListViewItem
various fixes to current item / selected item updates after bookmark deletion
update listview items based on changes in bookmarkinfo dialog
illustrate more clearly when a bookmark is in the selection:
   a lighter highlight is used than the actual qt selection highlighting
don't select the first listview item when someone clicks in the search linedit
don't notify all konquerors using deprecated notifyCompleteChange when saving:
   reuse waldo's dcop signal emitter - emitChanged()

strings added:
   "Times Visited"
   "Click here and type to search..."
      (was "Type here to search...", which looks very stupid)
sorry translators!!!! (for backgrounder, i am without internet so couldn't commit :()

svn path=/trunk/kdebase/konqueror/keditbookmarks/; revision=264167
This commit is contained in:
Alexander Kellett 2003-11-03 10:33:23 +00:00
parent 536775e730
commit 6bf8aa8bab
16 changed files with 273 additions and 103 deletions

View file

@ -368,7 +368,7 @@ void KEBApp::setActionsEnabled(SelcAbilities sa) {
it != toEnable.end(); ++it )
{
coll->action((*it).ascii())->setEnabled(true);
//kdDebug() << (*it) << endl;
// kdDebug() << (*it) << endl;
}
}
@ -435,8 +435,8 @@ void ActionsImpl::slotInsertSeparator() {
}
void ActionsImpl::slotImport() {
kdDebug() << "ActionsImpl::slotImport() where sender()->name() == "
<< sender()->name() << endl;
// kdDebug() << "ActionsImpl::slotImport() where sender()->name() == "
// << sender()->name() << endl;
ImportCommand* import
= ImportCommand::performImport(sender()->name()+6, KEBApp::self());
if (!import)
@ -494,6 +494,7 @@ void ActionsImpl::slotDelayedPrint() {
Q_ASSERT(s_part);
DCOPRef(s_appId, s_objId).send("print", false);
// delete s_part; -- dies horribly atm
// TODO - is this a leak?
s_part = 0;
}
@ -503,6 +504,8 @@ void ActionsImpl::slotShowNS() {
bool shown = KEBApp::self()->nsShown();
CurrentMgr::self()->mgr()->setShowNSBookmarks(shown);
KEBApp::self()->setModifiedFlag(true);
// TODO - need to force a save here
CurrentMgr::self()->reloadConfig();
}
void ActionsImpl::slotCancelFavIconUpdates() {

View file

@ -71,7 +71,6 @@ public slots:
// ugly hack really...
void slotDelayedPrint();
public:
static ActionsImpl* self() { if (!s_self) { s_self = new ActionsImpl(); }; return s_self; }
~ActionsImpl();

View file

@ -46,61 +46,151 @@
#include <kbookmarkdrag.h>
#include <kbookmarkmanager.h>
void BookmarkInfoWidget::showBookmark(const KBookmark &bk) {
m_title_le->setText(bk.text());
m_url_le->setText(bk.url().url());
// SHUFFLE all these functions around, the order is just plain stupid
m_comment_le->setText(
NodeEditCommand::getNodeText(bk, QStringList() << "desc"));
m_moddate_le->setText(
NodeEditCommand::getNodeText(bk, QStringList() << "info"
<< "metadata"
<< "time_added" ));
m_credate_le->setText(
NodeEditCommand::getNodeText(bk, QStringList() << "info"
<< "metadata"
<< "time_added" ));
// rename to something else
static QString blah(QString in)
{
int secs;
bool ok;
secs = in.toInt(&ok);
if (!ok)
return QString::null;
QDateTime td;
td.setTime_t(secs);
return td.toString("dd.MM.yyyy - hh:mm");
}
BookmarkInfoWidget::BookmarkInfoWidget(
QWidget * parent, const char * name
) : QWidget (parent, name) {
void BookmarkInfoWidget::showBookmark(const KBookmark &bk) {
m_bk = bk;
if (m_bk.isNull()) {
// all read only and blank
m_title_le->setReadOnly(true);
m_title_le->setText(QString::null);
m_url_le->setReadOnly(true);
m_url_le->setText(QString::null);
m_comment_le->setReadOnly(true);
m_comment_le->setText(QString::null);
m_visitdate_le->setReadOnly(true);
m_visitdate_le->setText(QString::null);
m_credate_le->setReadOnly(true);
m_credate_le->setText(QString::null);
m_visitcount_le->setReadOnly(true);
m_visitcount_le->setText(QString::null);
return;
}
// read/write fields
m_title_le->setReadOnly(false);
m_title_le->setText(bk.fullText());
m_url_le->setReadOnly(false);
m_url_le->setText(bk.url().url());
m_comment_le->setReadOnly(false);
m_comment_le->setText(
NodeEditCommand::getNodeText(bk, QStringList() << "desc"));
// readonly fields
QString visitDate =
blah( NodeEditCommand::getNodeText(bk, QStringList() << "info" << "metadata"
<< "time_visited" ));
m_visitdate_le->setReadOnly(true);
m_visitdate_le->setText(visitDate);
QString creationDate =
blah( NodeEditCommand::getNodeText(bk, QStringList() << "info" << "metadata"
<< "time_added" ));
m_credate_le->setReadOnly(true);
m_credate_le->setText(creationDate);
// TODO - get the actual field name from the spec if it exists, else copy galeon
m_visitcount_le->setReadOnly(true);
m_visitcount_le->setText(
NodeEditCommand::getNodeText(bk, QStringList() << "info" << "metadata"
<< "visit_count" ));
}
void BookmarkInfoWidget::slotTextChangedTitle(const QString &str) {
if (m_bk.isNull() || str == m_bk.fullText() )
return;
NodeEditCommand::setNodeText(m_bk, QStringList() << "title", str);
emit updateListViewItem();
}
void BookmarkInfoWidget::slotTextChangedURL(const QString &str) {
if (m_bk.isNull() || str == m_bk.url().url() )
return;
m_bk.internalElement().setAttribute("href", KURL(str).url(0, 106));
emit updateListViewItem();
}
void BookmarkInfoWidget::slotTextChangedComment(const QString &str) {
if (m_bk.isNull() || str == NodeEditCommand::getNodeText(m_bk, QStringList() << "desc") )
return;
NodeEditCommand::setNodeText(m_bk, QStringList() << "desc", str);
emit updateListViewItem();
}
BookmarkInfoWidget::BookmarkInfoWidget(QWidget *parent, const char *name)
: QWidget(parent, name), m_connected(false) {
QBoxLayout *vbox = new QVBoxLayout(this);
QGridLayout *grid = new QGridLayout(vbox, 3, 4);
QGridLayout *grid = new QGridLayout(vbox, 3, 4, 4);
m_title_le = new KLineEdit(this);
m_title_le->setReadOnly(true);
grid->addWidget(m_title_le, 0, 1);
grid->addWidget(
new QLabel(m_title_le, i18n("Name:"), this),
0, 0);
connect(m_title_le, SIGNAL( textChanged(const QString &) ),
SLOT( slotTextChangedTitle(const QString &) ));
m_url_le = new KLineEdit(this);
m_url_le->setReadOnly(true);
grid->addWidget(m_url_le, 1, 1);
grid->addWidget(
new QLabel(m_url_le, i18n("Location:"), this),
1, 0);
connect(m_url_le, SIGNAL( textChanged(const QString &) ),
SLOT( slotTextChangedURL(const QString &) ));
m_comment_le = new KLineEdit(this);
m_comment_le->setReadOnly(true);
grid->addWidget(m_comment_le, 2, 1);
grid->addWidget(
new QLabel(m_comment_le, i18n("Comment:"), this),
2, 0);
connect(m_comment_le, SIGNAL( textChanged(const QString &) ),
SLOT( slotTextChangedComment(const QString &) ));
m_moddate_le = new KLineEdit(this);
m_moddate_le->setReadOnly(true);
grid->addWidget(m_moddate_le, 0, 3);
m_visitdate_le = new KLineEdit(this);
grid->addWidget(m_visitdate_le, 0, 3);
grid->addWidget(
new QLabel(m_moddate_le, i18n("First viewed:"), this),
new QLabel(m_visitdate_le, i18n("First viewed:"), this),
0, 2 );
m_credate_le = new KLineEdit(this);
m_credate_le->setReadOnly(true);
grid->addWidget(m_credate_le, 1, 3);
grid->addWidget(
new QLabel(m_credate_le, i18n("Viewed last:"), this),
1, 2);
m_visitcount_le = new KLineEdit(this);
grid->addWidget(m_visitcount_le, 2, 3);
grid->addWidget(
new QLabel(m_visitcount_le, i18n("Times visited:"), this),
2, 2);
}
#include "bookmarkinfo.moc"

View file

@ -28,12 +28,26 @@
class KLineEdit;
class BookmarkInfoWidget : public QWidget {
Q_OBJECT
public:
BookmarkInfoWidget(QWidget * = 0, const char * = 0);
void showBookmark(const KBookmark &bk);
BookmarkInfoWidget(QWidget * = 0, const char * = 0);
void showBookmark(const KBookmark &bk);
void saveBookmark(const KBookmark &bk);
bool connected() { return m_connected; };
void setConnected(bool b) { m_connected = b; };
public slots:
void slotTextChangedURL(const QString &);
void slotTextChangedTitle(const QString &);
void slotTextChangedComment(const QString &);
signals:
void updateListViewItem();
private:
KLineEdit *m_title_le, *m_url_le, *m_comment_le, *m_moddate_le, *m_credate_le;
KBookmark m_bk;
KLineEdit *m_title_le, *m_url_le,
*m_comment_le,
*m_visitdate_le, *m_credate_le,
*m_visitcount_le;
KBookmark m_bk;
bool m_connected;
};
#endif

View file

@ -188,16 +188,17 @@ QString NodeEditCommand::getNodeText(KBookmark bk, const QStringList &nodehier)
: subnode.firstChild().toText().data();
}
void NodeEditCommand::execute() {
// DUPLICATED HEAVILY FROM KIO/BOOKMARKS
KBookmark bk = CurrentMgr::bookmarkAt(m_address);
Q_ASSERT(!bk.isNull());
QDomNode subnode = bk.internalElement().namedItem(m_nodename);
if (subnode.isNull()) {
subnode =
bk.internalElement().ownerDocument().createElement(m_nodename);
bk.internalElement().appendChild(subnode);
QString NodeEditCommand::setNodeText(KBookmark bk, const QStringList &nodehier,
const QString newValue) {
QDomNode subnode = bk.internalElement();
for (QStringList::ConstIterator it = nodehier.begin();
it != nodehier.end(); ++it)
{
subnode = subnode.namedItem((*it));
if (subnode.isNull()) {
subnode = bk.internalElement().ownerDocument().createElement((*it));
bk.internalElement().appendChild(subnode);
}
}
if (subnode.firstChild().isNull()) {
@ -207,8 +208,16 @@ void NodeEditCommand::execute() {
QDomText domtext = subnode.firstChild().toText();
m_oldText = domtext.data();
domtext.setData(m_newText);
QString oldText = domtext.data();
domtext.setData(newValue);
return oldText;
}
void NodeEditCommand::execute() {
// DUPLICATED HEAVILY FROM KIO/BOOKMARKS
KBookmark bk = CurrentMgr::bookmarkAt(m_address);
Q_ASSERT(!bk.isNull());
m_oldText = setNodeText(bk, QStringList() << m_nodename, m_newText);
}
void NodeEditCommand::unexecute() {
@ -236,7 +245,7 @@ void DeleteCommand::execute() {
while (!n.isNull()) {
QDomElement e = n.toElement();
if (!e.isNull()) {
kdDebug() << e.tagName() << endl;
// kdDebug() << e.tagName() << endl;
}
QDomNode next = n.nextSibling();
groupRoot.removeChild(n);

View file

@ -124,6 +124,8 @@ public:
virtual void unexecute();
virtual QString name() const;
static QString getNodeText(KBookmark bk, const QStringList &nodehier);
static QString setNodeText(KBookmark bk, const QStringList &nodehier,
QString newValue);
private:
QString m_address;
QString m_newText;

View file

@ -57,7 +57,7 @@ void KBookmarkEditorIface::slotDcopUpdatedAccessMetadata(QString filename, QStri
// TODO - i'm not sure this is really true :)
if (/*KEBApp::self()->modified() &&*/ filename == CurrentMgr::self()->path()) {
kdDebug() << "slotDcopUpdatedAccessMetadata(" << url << ")" << endl;
// kdDebug() << "slotDcopUpdatedAccessMetadata(" << url << ")" << endl;
// no undo
CurrentMgr::self()->mgr()->updateAccessMetadata(url, false);
// notice - no save here! see! :)
@ -66,7 +66,7 @@ void KBookmarkEditorIface::slotDcopUpdatedAccessMetadata(QString filename, QStri
void KBookmarkEditorIface::slotDcopAddedBookmark(QString filename, QString url, QString text, QString address, QString icon) {
if (KEBApp::self()->modified() && filename == CurrentMgr::self()->path()) {
kdDebug() << "slotDcopAddedBookmark(" << url << "," << text << "," << address << "," << icon << ")" << endl;
// kdDebug() << "slotDcopAddedBookmark(" << url << "," << text << "," << address << "," << icon << ")" << endl;
CreateCommand *cmd = new CreateCommand(
CurrentMgr::self()->correctAddress(address),
text, icon, KURL(url), true /*indirect*/);
@ -76,7 +76,7 @@ void KBookmarkEditorIface::slotDcopAddedBookmark(QString filename, QString url,
void KBookmarkEditorIface::slotDcopCreatedNewFolder(QString filename, QString text, QString address) {
if (KEBApp::self()->modified() && filename == CurrentMgr::self()->path()) {
kdDebug() << "slotDcopCreatedNewFolder(" << text << "," << address << ")" << endl;
// kdDebug() << "slotDcopCreatedNewFolder(" << text << "," << address << ")" << endl;
CreateCommand *cmd = new CreateCommand(
CurrentMgr::self()->correctAddress(address),
text, QString::null,

View file

@ -55,7 +55,7 @@ FavIconsItr::~FavIconsItr() {
}
void FavIconsItr::slotDone(bool succeeded) {
kdDebug() << "FavIconsItr::slotDone()" << endl;
// kdDebug() << "FavIconsItr::slotDone()" << endl;
m_done = true;
curItem()->setTmpStatus(succeeded ? i18n("OK") : i18n("No favicon found"));
delayedEmitNextOne();
@ -66,7 +66,7 @@ bool FavIconsItr::isApplicable(const KBookmark &bk) const {
}
void FavIconsItr::doAction() {
kdDebug() << "FavIconsItr::doAction()" << endl;
// kdDebug() << "FavIconsItr::doAction()" << endl;
m_done = false;
curItem()->setTmpStatus(i18n("Updating favicon..."));
if (!m_updater) {

View file

@ -130,7 +130,7 @@ ListView::Which ListView::whichChildrenSelected(KEBListViewItem *item) {
QListViewItem *endOfFolder
= item->nextSibling() ? item->nextSibling()->itemAbove() : 0;
QListViewItemIterator it((QListViewItem*)item);
it++;
it++; // skip parent
QListViewItem *last = 0;
for( ; it.current() && (last != endOfFolder); (last = it.current()), it++) {
KEBListViewItem *item = static_cast<KEBListViewItem *>(it.current());
@ -149,14 +149,14 @@ void ListView::deselectAllButParent(KEBListViewItem *item) {
QListViewItem *endOfFolder
= item->nextSibling() ? item->nextSibling()->itemAbove() : 0;
QListViewItemIterator it((QListViewItem*)item);
it++;
it++; // skip parent
QListViewItem *last = 0;
for( ; it.current() && (last != endOfFolder); (last = it.current()), it++) {
KEBListViewItem *item = static_cast<KEBListViewItem *>(it.current());
if (VALID_ITEM(item) && item->isSelected())
it.current()->setSelected(false);
item->listView()->setSelected(it.current(), false);
}
item->setSelected(true);
item->listView()->setSelected(item, true);
}
void ListView::updateSelectedItems() {
@ -165,9 +165,10 @@ void ListView::updateSelectedItems() {
// adjust the current selection
QPtrListIterator<KEBListViewItem> it(*(m_listView->itemList()));
for ( ; it.current() != 0; ++it) {
if ( !( VALID_ITEM(it.current())
&& it.current()->isSelected() ))
if ( !VALID_ITEM(it.current())
|| !it.current()->isSelected() )
continue;
// needed - FIXME - why?
selected = true;
// don't bother looking into it if its not a folder
if (it.current()->childCount() == 0)
@ -178,7 +179,7 @@ void ListView::updateSelectedItems() {
deselectAllButParent(it.current());
} else if (which == SomeChildren) {
// don't select outer folder
it.current()->setSelected(false);
m_listView->setSelected(it.current(), false);
}
}
if (!selected)
@ -187,8 +188,8 @@ void ListView::updateSelectedItems() {
// deselect empty folders if there is a real selection
for (QPtrListIterator<KEBListViewItem> it(*(m_listView->itemList()));
it.current() != 0; ++it) {
if (!VALID_ITEM(it.current())) {
it.current()->setSelected(false); }
if (!VALID_ITEM(it.current()))
m_listView->setSelected(it.current(), false);
}
}
@ -342,7 +343,7 @@ void ListView::updateListView() {
s_selected_addresses << it.current()->bookmark().address();
int lastCurrentY = m_listView->contentsY();
updateTree();
if (selectedItems()->isEmpty())
if (selectedItems()->isEmpty() && m_listView->currentItem())
m_listView->setSelected(m_listView->currentItem(), true);
m_listView->ensureVisible(0, lastCurrentY, 0, 0);
m_listView->ensureVisible(0, lastCurrentY + m_listView->visibleHeight(), 0, 0);
@ -358,7 +359,8 @@ void ListView::updateTree(bool updateSplitView) {
if (m_splitView && updateSplitView)
fillWithGroup(m_folderListView, CurrentMgr::self()->mgr()->root());
s_listview_is_dirty = true;
setCurrent(s_lazySettingCurrentItem);
if (s_lazySettingCurrentItem)
setCurrent(s_lazySettingCurrentItem);
s_lazySettingCurrentItem = 0;
}
@ -375,8 +377,6 @@ void ListView::fillWithGroup(KEBListView *lv, KBookmarkGroup group, KEBListViewI
}
if (m_splitView && !lv->isFolderList())
lastItem = new KEBListViewItem(lv, lastItem, group);
s_lazySettingCurrentItem = 0;
QString correctedCurrentAddr = CurrentMgr::self()->correctAddress(m_last_selection_address);
for (KBookmark bk = group.first(); !bk.isNull(); bk = group.next(bk)) {
KEBListViewItem *item = 0;
if (bk.isGroup()) {
@ -405,13 +405,15 @@ void ListView::fillWithGroup(KEBListView *lv, KBookmarkGroup group, KEBListViewI
}
if (s_selected_addresses.contains(bk.address()))
lv->setSelected(item, true);
// TODO this is far too exact, we need to do partial + best match system
QString correctedCurrentAddr = CurrentMgr::self()->correctAddress(m_last_selection_address);
if (bk.address() == correctedCurrentAddr)
s_lazySettingCurrentItem = item;
}
}
void ListView::handleMoved(KEBListView *) {
kdDebug() << "ListView::handleMoved()" << endl;
// kdDebug() << "ListView::handleMoved()" << endl;
/* TODO - neil's wishlist item - unfortunately handleMoved is not called sometimes...
* KMacroCommand *mcmd = CmdGen::self()->deleteItems( i18n("Moved Items"),
* ListView::self()->selectedItems());
@ -425,7 +427,9 @@ void ListView::handleCurrentChanged(KEBListView *lv, QListViewItem *item) {
KEBListViewItem *currentItem = static_cast<KEBListViewItem *>(item);
if (VALID_FIRST(selectedItems()))
// note, for some reason just doing count() > 0 means that the
// selectedItems list seems to follow the old current. *realy wierd*
if (selectedItems()->count() > 1 && VALID_FIRST(selectedItems()))
m_last_selection_address = selectedItems()->first()->bookmark().address();
else if (VALID_ITEM(currentItem))
m_last_selection_address = currentItem->bookmark().address();
@ -444,8 +448,34 @@ void ListView::handleSelectionChanged(KEBListView *) {
s_listview_is_dirty = true;
updateSelectedItems();
KEBApp::self()->updateActions();
if (VALID_FIRST(selectedItems()))
KEBApp::self()->bkInfo()->showBookmark(selectedItems()->first()->bookmark());
if (selectedItems()->count() != 1
|| !VALID_FIRST(selectedItems())
) {
KEBApp::self()->bkInfo()->showBookmark(KBookmark());
return;
}
if (!KEBApp::self()->bkInfo()->connected()) {
connect(KEBApp::self()->bkInfo(), SIGNAL( updateListViewItem() ),
SLOT( slotBkInfoUpdateListViewItem() ));
KEBApp::self()->bkInfo()->setConnected(true);
}
KEBApp::self()->bkInfo()->showBookmark(selectedItems()->first()->bookmark());
}
void ListView::slotBkInfoUpdateListViewItem() {
// its not possible that the selection changed inbetween as
// handleSelectionChanged is the one that sets up bkInfo()
// to emit this signal, otoh. maybe this can cause various
// differing responses.
// kdDebug() << "slotBkInfoUpdateListViewItem()" << endl;
KEBApp::self()->setModifiedFlag(true);
KEBListViewItem *i = selectedItems()->first();
Q_ASSERT(i);
KBookmark bk = i->bookmark();
i->setText(KEBListView::NameColumn, bk.fullText());
i->setText(KEBListView::UrlColumn, bk.url().url());
QString commentStr = NodeEditCommand::getNodeText(bk, QStringList() << "desc");
i->setText(KEBListView::CommentColumn, commentStr);
}
void ListView::handleContextMenu(KEBListView *, KListView *, QListViewItem *qitem, const QPoint &p) {
@ -794,12 +824,36 @@ void KEBListViewItem::setOpen(bool open) {
void KEBListViewItem::paintCell(QPainter *p, const QColorGroup &ocg, int col, int w, int a) {
QColorGroup cg(ocg);
bool parentSelected = false;
KEBListViewItem *allTheWayToTheRoot = this;
while (allTheWayToTheRoot
= static_cast<KEBListViewItem *>(allTheWayToTheRoot->parent()),
allTheWayToTheRoot) {
if (allTheWayToTheRoot->isSelected()
&& allTheWayToTheRoot != listView()->firstChild() )
parentSelected = true;
};
if (parentSelected && ListView::self()->selectedItems()->count() != 1) {
int base_h, base_s, base_v;
cg.background().hsv(&base_h, &base_s, &base_v);
int hilite_h, hilite_s, hilite_v;
cg.highlight().hsv(&hilite_h, &hilite_s, &hilite_v);
QColor col(hilite_h,
(hilite_s + base_s + base_s ) / 3,
(hilite_v + base_v + base_v ) / 3,
QColor::Hsv);
cg.setColor(QColorGroup::Base, col);
}
if (col == KEBListView::StatusColumn) {
switch (m_paintStyle) {
case KEBListViewItem::TempStyle:
{
int h, s, v;
cg.background().hsv(&h,&s,&v);
cg.background().hsv(&h, &s, &v);
QColor color = (v > 180 && v < 220) ? (Qt::darkGray) : (Qt::gray);
cg.setColor(QColorGroup::Text, color);
break;

View file

@ -177,6 +177,9 @@ public:
~ListView();
public slots:
void slotBkInfoUpdateListViewItem();
private:
void updateTree(bool updateSplitView = true);
void fillWithGroup(KEBListView *, KBookmarkGroup, KEBListViewItem * = 0);

View file

@ -136,14 +136,11 @@ extern "C" int kdemain(int argc, char **argv) {
bool gotArg = (args->count() == 1);
kdDebug() << (qApp->type() == QApplication::Tty) << endl;
QString filename = gotArg
? QString::fromLatin1(args->arg(0))
: locateLocal("data", QString::fromLatin1("konqueror/bookmarks.xml"));
if (!isGui) {
kdDebug() << CurrentMgr::self() << endl;
CurrentMgr::self()->createManager(filename);
CurrentMgr::ExportType exportType = CurrentMgr::MozillaExport; // uumm.. can i just set it to -1 ?
int got = 0;
@ -161,16 +158,13 @@ extern "C" int kdemain(int argc, char **argv) {
Q_ASSERT(arg2);
// TODO - maybe an xbel export???
if (got > 1) // got == 0 isn't possible as !isGui is dependant on "export.*"
KCmdLineArgs::usage(I18N_NOOP("You may only specify a single --export option."));
KCmdLineArgs::usage(I18N_NOOP("You may only a single --export option."));
QString path = QString::fromLocal8Bit(args->getOption(arg2));
CurrentMgr::self()->doExport(exportType, path);
} else if (importType) {
kdDebug() << importType << endl;
if (got > 1) // got == 0 isn't possible as !isGui is dependant on "import.*"
KCmdLineArgs::usage(I18N_NOOP("You may only specify a single --import option."));
kdDebug() << filename << endl;
KCmdLineArgs::usage(I18N_NOOP("You may only a single --import option."));
QString path = QString::fromLocal8Bit(args->getOption(arg2));
kdDebug() << path << endl;
ImportCommand *importer = ImportCommand::importerFactory(importType);
importer->import(path, true);
importer->execute();

View file

@ -160,6 +160,8 @@ void Searcher::slotSearchNext()
void Searcher::slotSearchTextChanged(const QString & text)
{
if (text.isEmpty() || text == i18n("Click here and type to search..."))
return;
if (!m_bktextmap)
m_bktextmap = new KBookmarkTextMap(CurrentMgr::self()->mgr());
m_bktextmap->update(); // FIXME - make this public and use it!!!

View file

@ -56,7 +56,7 @@ TestLinkItr::TestLinkItr(QValueList<KBookmark> bks)
TestLinkItr::~TestLinkItr() {
if (m_job) {
kdDebug() << "JOB kill\n";
// kdDebug() << "JOB kill\n";
curItem()->restoreStatus();
m_job->disconnect();
m_job->kill(false);
@ -312,13 +312,13 @@ void KEBListViewItem::modUpdate() {
// KEBListViewItem !!!!!!!!!!!
void KEBListViewItem::setOldStatus(const QString &oldStatus) {
kdDebug() << "KEBListViewItem::setOldStatus" << endl;
// kdDebug() << "KEBListViewItem::setOldStatus" << endl;
m_oldStatus = oldStatus;
}
// KEBListViewItem !!!!!!!!!!!
void KEBListViewItem::setTmpStatus(const QString &status) {
kdDebug() << "KEBListViewItem::setTmpStatus" << endl;
// kdDebug() << "KEBListViewItem::setTmpStatus" << endl;
m_paintStyle = KEBListViewItem::BoldStyle;
setText(KEBListView::StatusColumn, status);
}
@ -326,7 +326,7 @@ void KEBListViewItem::setTmpStatus(const QString &status) {
// KEBListViewItem !!!!!!!!!!!
void KEBListViewItem::restoreStatus() {
if (!m_oldStatus.isNull()) {
kdDebug() << "KEBListViewItem::restoreStatus" << endl;
// kdDebug() << "KEBListViewItem::restoreStatus" << endl;
TestLinkItrHolder::self()->resetToValue(m_bookmark.url().url(), m_oldStatus);
modUpdate();
}

View file

@ -148,10 +148,12 @@ void CurrentMgr::slotBookmarksChanged(const QString &, const QString &caller) {
}
void CurrentMgr::notifyManagers() {
QCString objId("KBookmarkManager-");
objId += mgr()->path().utf8();
DCOPRef("*", objId).send("notifyCompleteChange",
QString::fromLatin1(kapp->dcopClient()->appId()));
KBookmarkGroup grp = mgr()->root();
mgr()->emitChanged(grp);
}
void CurrentMgr::reloadConfig() {
mgr()->emitConfigChanged();
}
QString CurrentMgr::correctAddress(const QString &address) const {
@ -175,7 +177,7 @@ KEBApp::KEBApp(
int h = 20;
QSplitter *vsplitter = new QSplitter(this);
m_iSearchLineEdit = new MagicKLineEdit(i18n("Type here to search..."),
m_iSearchLineEdit = new MagicKLineEdit(i18n("Click here and type to search..."),
vsplitter);
m_iSearchLineEdit->setMinimumHeight(h);
m_iSearchLineEdit->setMaximumHeight(h);
@ -277,7 +279,7 @@ void KEBApp::readConfig() {
KConfig config("kbookmarkrc", false, false);
config.setGroup("Bookmarks");
m_advancedAddBookmark
= config.readBoolEntry("AdvancedAddBookmark", false);
= config.readBoolEntry("AdvancedAddBookmarkDialog", true);
m_filteredToolbar = config.readBoolEntry("FilteredToolbar", false);
}
@ -294,12 +296,8 @@ static void writeConfigBool(
KConfig config(rcfile, false, false);
config.setGroup(group);
config.writeEntry(entry, flag);
}
// temporary only
static void sorryRelogin(QWidget *p) {
KMessageBox::sorry(p, "<qt>In order to see the affect of this setting<br>"
"modification you will need to relogin.</qt>");
config.sync();
CurrentMgr::self()->reloadConfig();
}
void KEBApp::slotAdvancedAddBookmark() {
@ -307,8 +305,7 @@ void KEBApp::slotAdvancedAddBookmark() {
m_advancedAddBookmark = getToggleAction("settings_advancedaddbookmark")
->isChecked();
writeConfigBool("kbookmarkrc", "Bookmarks",
"AdvancedAddBookmark", m_advancedAddBookmark);
sorryRelogin(this);
"AdvancedAddBookmarkDialog", m_advancedAddBookmark);
}
void KEBApp::slotFilteredToolbar() {
@ -316,15 +313,18 @@ void KEBApp::slotFilteredToolbar() {
getToggleAction("settings_filteredtoolbar")->isChecked();
writeConfigBool("kbookmarkrc", "Bookmarks",
"FilteredToolbar", m_filteredToolbar);
sorryRelogin(this);
// KMessageBox::sorry(p, "<qt>After enabling this option right click actions "
// "on the bookmark toolbar will be disabled<br></qt>");
}
void KEBApp::slotSplitView() {
Q_ASSERT( 0 );
#if 0
m_splitView = getToggleAction("settings_splitview")->isChecked();
writeConfigBool("keditbookmarksrc", "General",
"Split View", m_splitView);
sorryRelogin(this);
#endif
}
void KEBApp::slotSaveOnClose() {

View file

@ -91,6 +91,8 @@ public:
void doExport(ExportType type, const QString & path = QString::null);
void setUpdate(bool update);
void reloadConfig();
protected slots:
void slotBookmarksChanged(const QString &, const QString &);

View file

@ -37,12 +37,10 @@
FavIconUpdater::FavIconUpdater(QObject *parent, const char *name)
: KonqFavIconMgr(parent, name) {
m_part = 0;
m_browserIface = 0;
m_webGrabber = 0;
}
void FavIconUpdater::slotCompleted() {
kdDebug() << "FavIconUpdater::slotCompleted" << endl;
// kdDebug() << "FavIconUpdater::slotCompleted" << endl;
// kdDebug() << "emit done(true)" << endl;
emit done(true);
}
@ -67,7 +65,7 @@ void FavIconUpdater::downloadIcon(const KBookmark &bk) {
}
FavIconUpdater::~FavIconUpdater() {
kdDebug() << "~FavIconUpdater" << endl;
// kdDebug() << "~FavIconUpdater" << endl;
delete m_browserIface;
delete m_webGrabber;
delete m_part;
@ -112,7 +110,7 @@ void FavIconUpdater::setIconURL(const KURL &iconURL) {
}
void FavIconUpdater::notifyChange(bool isHost, QString hostOrURL, QString iconName) {
kdDebug() << "FavIconUpdater::notifyChange()" << endl;
// kdDebug() << "FavIconUpdater::notifyChange()" << endl;
Q_UNUSED(isHost);
// kdDebug() << isHost << endl;
@ -128,7 +126,7 @@ void FavIconUpdater::notifyChange(bool isHost, QString hostOrURL, QString iconNa
FavIconWebGrabber::FavIconWebGrabber(KParts::ReadOnlyPart *part, const KURL &url)
: m_part(part), m_url(url) {
kdDebug() << "FavIconWebGrabber::FavIconWebGrabber starting KIO::get()" << endl;
// kdDebug() << "FavIconWebGrabber::FavIconWebGrabber starting KIO::get()" << endl;
// the use of KIO rather than directly using KHTML is to allow silently abort on error
@ -153,7 +151,7 @@ void FavIconWebGrabber::slotMimetype(KIO::Job *job, const QString & /*type*/) {
void FavIconWebGrabber::slotFinished(KIO::Job *job) {
if (job->error()) {
kdDebug() << "FavIconWebGrabber::slotFinished() " << job->errorString() << endl;
// kdDebug() << "FavIconWebGrabber::slotFinished() " << job->errorString() << endl;
}
}