void BookmarkHandler::openBookmark(const KBookmark& bm, Qt::MouseButtons, Qt::KeyboardModifiers) { // qDebug()<<bm.description()<<bm.fullText()<<bm.text()<<bm.address() << bm.url(); if (bm.description().trimmed().length() > 0) { KUrl aurl = bm.url(); aurl.setPassword("aaaabcd"); aurl.setPassword(bm.description().trimmed()); qDebug()<<aurl << aurl.password(); emit openUrl(aurl); } else { emit openUrl(bm.url()); } }
KBookmarkActionMenu::KBookmarkActionMenu(const KBookmark &bm, QObject *parent) : KActionMenu(QIcon::fromTheme(bm.icon()), bm.text().replace('&', QLatin1String("&&")), parent), KBookmarkActionInterface(bm) { setToolTip(bm.description()); setIconText(text()); }
void BookmarksProtocol::echoBookmark( const KBookmark &bm) { QString descriptionAsTitle = bm.description().toHtmlEscaped(); if (!descriptionAsTitle.isEmpty()) descriptionAsTitle.prepend(QLatin1String("\" title=\"")); echo ("<li class=\"link\"><a href=\"" + bm.url().url() + descriptionAsTitle + "\"><img src=\"/icon/" + bm.icon() + "\"/>" + bm.text().toHtmlEscaped() + "</a></li>"); }
void EditCommand::redo() { KBookmark bk = m_model->bookmarkManager()->findByAddress(mAddress); if(mCol==-2) { if (mOldValue.isEmpty()) mOldValue = bk.internalElement().attribute("toolbar"); bk.internalElement().setAttribute("toolbar", mNewValue); } else if(mCol==-1) { if (mOldValue.isEmpty()) mOldValue = bk.icon(); bk.setIcon(mNewValue); } else if(mCol==0) { if (mOldValue.isEmpty()) // only the first time, not when compressing changes in modify() mOldValue = bk.fullText(); kDebug() << "mOldValue=" << mOldValue; bk.setFullText(mNewValue); } else if(mCol==1) { if (mOldValue.isEmpty()) mOldValue = bk.url().prettyUrl(); const KUrl newUrl(mNewValue); if (!(newUrl.isEmpty() && !mNewValue.isEmpty())) // prevent emptied line if the currently entered url is invalid bk.setUrl(newUrl); } else if(mCol==2) { if (mOldValue.isEmpty()) mOldValue = bk.description(); bk.setDescription(mNewValue); } m_model->emitDataChanged(bk); }
// SHUFFLE all these functions around, the order is just plain stupid void BookmarkInfoWidget::showBookmark(const KBookmark &bk) { // Fast exit if already shown, otherwise editing a title leads to a command after each keypress if (m_bk == bk) return; commitChanges(); m_bk = bk; if (m_bk.isNull()) { // all read only and blank m_title_le->setReadOnly(true); m_title_le->setText(QString()); m_url_le->setReadOnly(true); m_url_le->setText(QString()); m_comment_le->setReadOnly(true); m_comment_le->setText(QString()); m_visitdate_le->setReadOnly(true); m_visitdate_le->setText(QString()); m_credate_le->setReadOnly(true); m_credate_le->setText(QString()); m_visitcount_le->setReadOnly(true); m_visitcount_le->setText(QString()); return; } // read/write fields m_title_le->setReadOnly( (bk.isSeparator()|| !bk.hasParent() )? true : false); if (bk.fullText() != m_title_le->text()) m_title_le->setText(bk.fullText()); m_url_le->setReadOnly(bk.isGroup() || bk.isSeparator()); if (bk.isGroup()) { m_url_le->setText(QString()); } else { // Update the text if and only if the text represents a different URL to that // of the current bookmark - the old method, "m_url_le->text() != bk.url().pathOrUrl()", // created difficulties due to the ambiguity of converting URLs to text. (#172647) if (QUrl::fromUserInput(m_url_le->text()) != bk.url()) { const int cursorPosition = m_url_le->cursorPosition(); m_url_le->setText(bk.url().url(QUrl::PreferLocalFile)); m_url_le->setCursorPosition(cursorPosition); } } m_comment_le->setReadOnly((bk.isSeparator()|| !bk.hasParent()) ? true : false ); QString commentText = bk.description(); if (m_comment_le->text() != commentText) { const int cursorPosition = m_comment_le->cursorPosition(); m_comment_le->setText(commentText); m_comment_le->setCursorPosition(cursorPosition); } // readonly fields updateStatus(); }