MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / onAddBookmark

Method onAddBookmark

Plugins/WebBrowser/Bookmark/FrmBookmark.cpp:267–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267void CFrmBookmark::onAddBookmark()
268{
269 bool ok;
270 QString url = QInputDialog::getText(this, tr("Add bookmark"),
271 tr("Url:"), QLineEdit::Normal,
272 "http://", &ok);
273 if (!ok || url.isEmpty()) return;
274
275 QString title = QInputDialog::getText(this, tr("Add bookmark"),
276 tr("Title:"), QLineEdit::Normal,
277 "", &ok);
278 if (!ok) return;
279
280 BookmarkItem item(BookmarkType_Bookmark);
281 item.url = url;
282 item.title = title.isEmpty() ? url : title;
283 item.createdTime = QDateTime::currentDateTime();
284 item.lastVisitTime = item.createdTime;
285 item.modifiedTime = item.createdTime;
286
287 // 获取选中的文件夹
288 QModelIndex currentIndex = m_pTreeView->currentIndex();
289 if (currentIndex.isValid()) {
290 int type = currentIndex.data(Type).toInt();
291 if (BookmarkType_Folder == type) {
292 item.folderId = currentIndex.data(Qt::UserRole).toInt();
293 }
294 }
295
296 if (m_pDatabase->addBookmark(item)) {
297 refresh();
298 }
299}
300
301void CFrmBookmark::onAddFolder()
302{

Callers

nothing calls this directly

Calls 4

isValidMethod · 0.80
addBookmarkMethod · 0.80
isEmptyMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected