19
19
#include "bookmarkinfo.h"
20
20
#include "bookmarklistview.h"
21
21
#include "commands.h"
22
#include "commandhistory.h"
23
#include "toplevel.h" // for CurrentMgr
23
24
#include "bookmarkmodel.h"
25
26
#include <stdlib.h>
27
28
#include <QtCore/QTimer>
28
29
#include <QtGui/QLabel>
29
#include <QtGui/QGridLayout>
30
#include <QtGui/QHBoxLayout>
31
#include <QtGui/QFormLayout>
31
33
#include <klocale.h>
32
34
#include <kdebug.h>
34
#include <kapplication.h>
35
#include <kstandardaction.h>
38
#include <kedittoolbar.h>
39
#include <kmessagebox.h>
40
36
#include <klineedit.h>
41
#include <kfiledialog.h>
43
38
#include <kbookmark.h>
44
#include <kbookmarkmanager.h>
45
#include <QtCore/QEvent>
47
40
// SHUFFLE all these functions around, the order is just plain stupid
48
41
void BookmarkInfoWidget::showBookmark(const KBookmark &bk) {
87
80
// of the current bookmark - the old method, "m_url_le->text() != bk.url().pathOrUrl()",
88
81
// created difficulties due to the ambiguity of converting URLs to text. (#172647)
89
82
if (KUrl(m_url_le->text()) != bk.url()) {
90
const int cursorPosition = m_url_le->cursorPosition();
83
const int cursorPosition = m_url_le->cursorPosition();
91
84
m_url_le->setText(bk.url().pathOrUrl());
92
85
m_url_le->setCursorPosition(cursorPosition);
96
89
m_comment_le->setReadOnly((bk.isSeparator()|| !bk.hasParent()) ? true : false );
97
90
QString commentText = EditCommand::getNodeText(bk, QStringList() << "desc");
98
91
if (m_comment_le->text() != commentText) {
99
const int cursorPosition = m_comment_le->cursorPosition();
92
const int cursorPosition = m_comment_le->cursorPosition();
100
93
m_comment_le->setText(commentText);
101
m_comment_le->setCursorPosition(cursorPosition);
94
m_comment_le->setCursorPosition(cursorPosition);
104
97
// readonly fields
253
QGridLayout *grid = new QGridLayout(this);
246
QHBoxLayout *layout = new QHBoxLayout(this);
247
QFormLayout *form1 = new QFormLayout();
248
QFormLayout *form2 = new QFormLayout();
249
layout->addLayout(form1);
250
layout->addLayout(form2);
256
252
m_title_le = new KLineEdit(this);
257
253
m_title_le->setClearButtonShown(true);
258
grid->addWidget(m_title_le, 0, 1);
259
QLabel* label = new QLabel(i18n("Name:"), this);
260
label->setBuddy(m_title_le);
261
grid->addWidget(label, 0, 0);
254
form1->addRow(i18n("Name:"), m_title_le);
263
256
connect(m_title_le, SIGNAL( textChanged(const QString &) ),
264
257
SLOT( slotTextChangedTitle(const QString &) ));
267
260
m_url_le = new KLineEdit(this);
268
261
m_url_le->setClearButtonShown(true);
269
grid->addWidget(m_url_le, 1, 1);
270
label = new QLabel(i18n("Location:"), this);
271
label->setBuddy(m_url_le);
272
grid->addWidget(label, 1, 0);
262
form1->addRow(i18n("Location:"), m_url_le);
274
264
connect(m_url_le, SIGNAL( textChanged(const QString &) ),
275
265
SLOT( slotTextChangedURL(const QString &) ));
278
268
m_comment_le = new KLineEdit(this);
279
269
m_comment_le->setClearButtonShown(true);
280
grid->addWidget(m_comment_le, 2, 1);
281
label = new QLabel(i18n("Comment:"), this);
282
label->setBuddy(m_comment_le);
283
grid->addWidget(label, 2, 0);
270
form1->addRow(i18n("Comment:"), m_comment_le);
285
272
connect(m_comment_le, SIGNAL( textChanged(const QString &) ),
286
273
SLOT( slotTextChangedComment(const QString &) ));
287
274
connect(m_comment_le, SIGNAL( editingFinished() ), SLOT( commitComment() ));
289
276
m_credate_le = new KLineEdit(this);
290
grid->addWidget(m_credate_le, 0, 3);
291
label = new QLabel(i18n("First viewed:"), this);
292
label->setBuddy(m_credate_le);
293
grid->addWidget(label, 0, 2);
277
form2->addRow(i18n("First viewed:"), m_credate_le);
295
279
m_visitdate_le = new KLineEdit(this);
296
grid->addWidget(m_visitdate_le, 1, 3);
297
label = new QLabel(i18n("Viewed last:"), this);
298
label->setBuddy(m_visitdate_le);
299
grid->addWidget(label, 1, 2 );
280
form2->addRow(i18n("Viewed last:"), m_visitdate_le);
301
282
m_visitcount_le = new KLineEdit(this);
302
grid->addWidget(m_visitcount_le, 2, 3);
303
label = new QLabel(i18n("Times visited:"), this);
304
label->setBuddy(m_visitcount_le);
305
grid->addWidget(label, 2, 2);
283
form2->addRow(i18n("Times visited:"), m_visitcount_le);
307
285
showBookmark(KBookmark());