fb2text.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. #include "fb2text.hpp"
  2. #include "fb2dlgs.hpp"
  3. #include "fb2read.hpp"
  4. #include "fb2save.hpp"
  5. #include "fb2utils.h"
  6. #include "fb2html.h"
  7. #include "fb2xml2.h"
  8. #include <QAction>
  9. #include <QBoxLayout>
  10. #include <QDockWidget>
  11. #include <QFileDialog>
  12. #include <QInputDialog>
  13. #include <QMainWindow>
  14. #include <QNetworkRequest>
  15. #include <QStyle>
  16. #include <QStyleOptionFrame>
  17. #include <QToolBar>
  18. #include <QToolTip>
  19. #include <QUndoCommand>
  20. #include <QUndoStack>
  21. #include <QWebElement>
  22. #include <QWebInspector>
  23. #include <QWebFrame>
  24. #include <QWebPage>
  25. #include <QtDebug>
  26. //---------------------------------------------------------------------------
  27. // FbNoteView
  28. //---------------------------------------------------------------------------
  29. class FbNoteView : public QWebView
  30. {
  31. public:
  32. explicit FbNoteView(QWidget *parent, const QUrl &url);
  33. void hint(const QWebElement element, const QRect &rect);
  34. protected:
  35. void paintEvent(QPaintEvent *event);
  36. const QUrl m_url;
  37. };
  38. FbNoteView::FbNoteView(QWidget *parent, const QUrl &url)
  39. : QWebView(parent)
  40. , m_url(url)
  41. {
  42. }
  43. void FbNoteView::paintEvent(QPaintEvent *event)
  44. {
  45. QWebView::paintEvent(event);
  46. QPainter painter(this);
  47. painter.setPen(Qt::black);
  48. QSize size = geometry().size() - QSize(1, 1);
  49. painter.drawRect( QRect(QPoint(0, 0), size) );
  50. }
  51. void FbNoteView::hint(const QWebElement element, const QRect &rect)
  52. {
  53. QString html = element.toOuterXml();
  54. html.prepend(
  55. "<body bgcolor=lightyellow style='overflow:hidden;padding:0;margin:0;margin-top:2;'>"
  56. "<div class=body fb2_name=notes style='padding:0;margin:0;'>"
  57. );
  58. html.append("</div></body>");
  59. setGeometry(rect);
  60. setHtml(html, m_url);
  61. show();
  62. }
  63. //---------------------------------------------------------------------------
  64. // FbTextPage
  65. //---------------------------------------------------------------------------
  66. FbTextPage::FbTextPage(QObject *parent)
  67. : QWebPage(parent)
  68. {
  69. QWebSettings *s = settings();
  70. s->setAttribute(QWebSettings::AutoLoadImages, true);
  71. s->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
  72. s->setAttribute(QWebSettings::JavaEnabled, false);
  73. s->setAttribute(QWebSettings::JavascriptEnabled, true);
  74. s->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
  75. s->setAttribute(QWebSettings::PluginsEnabled, false);
  76. s->setAttribute(QWebSettings::ZoomTextOnly, true);
  77. s->setUserStyleSheetUrl(QUrl::fromLocalFile(":style.css"));
  78. setContentEditable(true);
  79. setNetworkAccessManager(new FbNetworkAccessManager(this));
  80. connect(this, SIGNAL(loadFinished(bool)), SLOT(loadFinished()));
  81. connect(this, SIGNAL(contentsChanged()), SLOT(fixContents()));
  82. }
  83. FbNetworkAccessManager *FbTextPage::temp()
  84. {
  85. return qobject_cast<FbNetworkAccessManager*>(networkAccessManager());
  86. }
  87. bool FbTextPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
  88. {
  89. Q_UNUSED(frame);
  90. if (type == NavigationTypeLinkClicked) {
  91. qCritical() << request.url().fragment();
  92. return false;
  93. // QToolTip::showText(request.url().fragment());
  94. }
  95. return QWebPage::acceptNavigationRequest(frame, request, type);
  96. }
  97. QString FbTextPage::div(const QString &style, const QString &text)
  98. {
  99. return QString("<div class=%1>%2</div>").arg(style).arg(text);
  100. }
  101. QString FbTextPage::p(const QString &text)
  102. {
  103. return QString("<p>%1</p>").arg(text);
  104. }
  105. FbTextElement FbTextPage::body()
  106. {
  107. return doc().findFirst("body");
  108. }
  109. FbTextElement FbTextPage::doc()
  110. {
  111. return mainFrame()->documentElement();
  112. }
  113. void FbTextPage::push(QUndoCommand * command, const QString &text)
  114. {
  115. undoStack()->beginMacro(text);
  116. undoStack()->push(command);
  117. undoStack()->endMacro();
  118. }
  119. void FbTextPage::update()
  120. {
  121. emit contentsChanged();
  122. emit selectionChanged();
  123. }
  124. void FbTextPage::appendSection(const FbTextElement &parent)
  125. {
  126. QString html = div("section", div("title", p()) + p());
  127. FbTextElement element = parent;
  128. element.appendInside(html);
  129. element = parent.lastChild();
  130. QUndoCommand * command = new FbInsertCmd(element);
  131. push(command, tr("Append section"));
  132. }
  133. void FbTextPage::insertBody()
  134. {
  135. QString html = div("body", div("title", p()) + div("section", div("title", p()) + p()));
  136. FbTextElement element = body();
  137. element.appendInside(html);
  138. element = element.lastChild();
  139. QUndoCommand * command = new FbInsertCmd(element);
  140. push(command, tr("Append body"));
  141. }
  142. void FbTextPage::insertSection()
  143. {
  144. FbTextElement element = current();
  145. while (!element.isNull()) {
  146. if (element.isSection() || element.isBody()) {
  147. appendSection(element);
  148. break;
  149. }
  150. element = element.parent();
  151. }
  152. }
  153. void FbTextPage::insertTitle()
  154. {
  155. FbTextElement element = current();
  156. while (!element.isNull()) {
  157. FbTextElement parent = element.parent();
  158. if ((parent.isSection() || parent.isBody()) && !parent.hasTitle()) {
  159. QString html = div("title", p());
  160. parent.prependInside(html);
  161. element = parent.firstChild();
  162. QUndoCommand * command = new FbInsertCmd(element);
  163. push(command, tr("Insert title"));
  164. break;
  165. }
  166. element = parent;
  167. }
  168. }
  169. void FbTextPage::insertSubtitle()
  170. {
  171. FbTextElement element = current();
  172. while (!element.isNull()) {
  173. FbTextElement parent = element.parent();
  174. if (parent.isSection()) {
  175. QString html = div("subtitle", p());
  176. if (element.isTitle()) {
  177. element.appendOutside(html);
  178. element = element.nextSibling();
  179. } else {
  180. element.prependOutside(html);
  181. element = element.previousSibling();
  182. }
  183. QUndoCommand * command = new FbInsertCmd(element);
  184. push(command, tr("Insert subtitle"));
  185. break;
  186. }
  187. element = parent;
  188. }
  189. }
  190. void FbTextPage::insertPoem()
  191. {
  192. FbTextElement element = current();
  193. while (!element.isNull()) {
  194. FbTextElement parent = element.parent();
  195. if (parent.isSection()) {
  196. QString html = div("poem", div("stanza", p()));
  197. if (element.isTitle()) {
  198. element.appendOutside(html);
  199. element = element.nextSibling();
  200. } else {
  201. element.prependOutside(html);
  202. element = element.previousSibling();
  203. }
  204. QUndoCommand * command = new FbInsertCmd(element);
  205. push(command, tr("Insert poem"));
  206. break;
  207. }
  208. element = parent;
  209. }
  210. }
  211. void FbTextPage::insertStanza()
  212. {
  213. FbTextElement element = current();
  214. while (!element.isNull()) {
  215. if (element.isStanza()) {
  216. QString html = div("stanza", p());
  217. element.appendOutside(html);
  218. element = element.nextSibling();
  219. QUndoCommand * command = new FbInsertCmd(element);
  220. push(command, tr("Append stanza"));
  221. break;
  222. }
  223. element = element.parent();
  224. }
  225. }
  226. void FbTextPage::insertAnnot()
  227. {
  228. }
  229. void FbTextPage::insertAuthor()
  230. {
  231. }
  232. void FbTextPage::insertEpigraph()
  233. {
  234. const QString type = "epigraph";
  235. FbTextElement element = current();
  236. while (!element.isNull()) {
  237. if (element.hasSubtype(type)) {
  238. QString html = div("epigraph", p());
  239. element = element.insertInside(type, html);
  240. QUndoCommand * command = new FbInsertCmd(element);
  241. push(command, tr("Insert epigraph"));
  242. break;
  243. }
  244. element = element.parent();
  245. }
  246. }
  247. void FbTextPage::insertDate()
  248. {
  249. }
  250. FbTextElement FbTextPage::current()
  251. {
  252. return element(location());
  253. }
  254. FbTextElement FbTextPage::element(const QString &location)
  255. {
  256. QStringList list = location.split(",");
  257. QStringListIterator iterator(list);
  258. QWebElement result = doc();
  259. while (iterator.hasNext()) {
  260. QString str = iterator.next();
  261. int pos = str.indexOf("=");
  262. QString tag = str.left(pos);
  263. int key = str.mid(pos + 1).toInt();
  264. if (key < 0) break;
  265. result = result.firstChild();
  266. while (0 < key--) result = result.nextSibling();
  267. }
  268. return result;
  269. }
  270. QString FbTextPage::location()
  271. {
  272. static const QString javascript = FB2::read(":/js/get_location.js").prepend("var element=document.getSelection().anchorNode;");
  273. return mainFrame()->evaluateJavaScript(javascript).toString();
  274. }
  275. QString FbTextPage::status()
  276. {
  277. static const QString javascript = FB2::read(":/js/get_status.js");
  278. return mainFrame()->evaluateJavaScript(javascript).toString();
  279. }
  280. void FbTextPage::loadFinished()
  281. {
  282. FbTextElement element = body().findFirst("div.body");
  283. if (element.isNull()) element = body();
  284. element.select();
  285. }
  286. void FbTextPage::fixContents()
  287. {
  288. foreach (QWebElement span, doc().findAll("span.apple-style-span[style]")) {
  289. span.removeAttribute("style");
  290. }
  291. }
  292. //---------------------------------------------------------------------------
  293. // FbTextBase
  294. //---------------------------------------------------------------------------
  295. void FbTextBase::addTools(QToolBar *tool)
  296. {
  297. QAction *act;
  298. act = pageAction(QWebPage::Undo);
  299. act->setIcon(FbIcon("edit-undo"));
  300. act->setText(QObject::tr("&Undo"));
  301. act->setPriority(QAction::LowPriority);
  302. act->setShortcut(QKeySequence::Undo);
  303. tool->addAction(act);
  304. act = pageAction(QWebPage::Redo);
  305. act->setIcon(FbIcon("edit-redo"));
  306. act->setText(QObject::tr("&Redo"));
  307. act->setPriority(QAction::LowPriority);
  308. act->setShortcut(QKeySequence::Redo);
  309. tool->addAction(act);
  310. tool->addSeparator();
  311. act = pageAction(QWebPage::Cut);
  312. act->setIcon(FbIcon("edit-cut"));
  313. act->setText(QObject::tr("Cu&t"));
  314. act->setPriority(QAction::LowPriority);
  315. act->setShortcuts(QKeySequence::Cut);
  316. act->setStatusTip(QObject::tr("Cut the current selection's contents to the clipboard"));
  317. tool->addAction(act);
  318. act = pageAction(QWebPage::Copy);
  319. act->setIcon(FbIcon("edit-copy"));
  320. act->setText(QObject::tr("&Copy"));
  321. act->setPriority(QAction::LowPriority);
  322. act->setShortcuts(QKeySequence::Copy);
  323. act->setStatusTip(QObject::tr("Copy the current selection's contents to the clipboard"));
  324. tool->addAction(act);
  325. act = pageAction(QWebPage::Paste);
  326. act->setIcon(FbIcon("edit-paste"));
  327. act->setText(QObject::tr("&Paste"));
  328. act->setPriority(QAction::LowPriority);
  329. act->setShortcuts(QKeySequence::Paste);
  330. act->setStatusTip(QObject::tr("Paste the clipboard's contents into the current selection"));
  331. tool->addAction(act);
  332. tool->addSeparator();
  333. act = pageAction(QWebPage::ToggleBold);
  334. act->setIcon(FbIcon("format-text-bold"));
  335. act->setText(QObject::tr("&Bold"));
  336. tool->addAction(act);
  337. act = pageAction(QWebPage::ToggleItalic);
  338. act->setIcon(FbIcon("format-text-italic"));
  339. act->setText(QObject::tr("&Italic"));
  340. tool->addAction(act);
  341. act = pageAction(QWebPage::ToggleStrikethrough);
  342. act->setIcon(FbIcon("format-text-strikethrough"));
  343. act->setText(QObject::tr("&Strikethrough"));
  344. tool->addAction(act);
  345. act = pageAction(QWebPage::ToggleSuperscript);
  346. act->setIcon(FbIcon("format-text-superscript"));
  347. act->setText(QObject::tr("Su&perscript"));
  348. tool->addAction(act);
  349. act = pageAction(QWebPage::ToggleSubscript);
  350. act->setIcon(FbIcon("format-text-subscript"));
  351. act->setText(QObject::tr("Su&bscript"));
  352. tool->addAction(act);
  353. }
  354. //---------------------------------------------------------------------------
  355. // FbTextEdit
  356. //---------------------------------------------------------------------------
  357. FbTextEdit::FbTextEdit(QWidget *parent)
  358. : FbTextBase(parent)
  359. , m_noteView(0)
  360. , m_thread(0)
  361. {
  362. setPage(new FbTextPage(this));
  363. }
  364. FbTextEdit::~FbTextEdit()
  365. {
  366. if (m_noteView) delete m_noteView;
  367. }
  368. FbTextPage *FbTextEdit::page()
  369. {
  370. return qobject_cast<FbTextPage*>(FbTextBase::page());
  371. }
  372. FbNetworkAccessManager *FbTextEdit::files()
  373. {
  374. return page()->temp();
  375. }
  376. FbNoteView & FbTextEdit::noteView()
  377. {
  378. if (m_noteView) return *m_noteView;
  379. m_noteView = new FbNoteView(qobject_cast<QWidget*>(parent()), url());
  380. m_noteView->setPage(new FbTextPage(this));
  381. m_noteView->page()->setNetworkAccessManager(page()->networkAccessManager());
  382. m_noteView->page()->setContentEditable(false);
  383. m_noteView->setGeometry(QRect(100, 100, 400, 200));
  384. return *m_noteView;
  385. }
  386. QWebElement FbTextEdit::body()
  387. {
  388. return doc().findFirst("body");
  389. }
  390. QWebElement FbTextEdit::doc()
  391. {
  392. return page()->mainFrame()->documentElement();
  393. }
  394. void FbTextEdit::mouseMoveEvent(QMouseEvent *event)
  395. {
  396. m_point = event->pos();
  397. QWebView::mouseMoveEvent(event);
  398. }
  399. void FbTextEdit::linkHovered(const QString &link, const QString &title, const QString &textContent)
  400. {
  401. Q_UNUSED(title);
  402. Q_UNUSED(textContent);
  403. const QString href = QUrl(link).fragment();
  404. if (href.isEmpty()) {
  405. if (m_noteView) m_noteView->hide();
  406. return;
  407. }
  408. const QString query = QString("DIV#%1").arg(href);
  409. const QWebElement element = doc().findFirst(query);
  410. if (element.isNull()) {
  411. if (m_noteView) m_noteView->hide();
  412. return;
  413. }
  414. QRect rect = geometry();
  415. QSize size = element.geometry().size() + QSize(2, 4);
  416. int center = rect.size().height() / 2;
  417. int h = size.height();
  418. if (h > center) size.setHeight(center - 10);
  419. int x = (rect.size().width() - size.width()) / 2;
  420. int y = m_point.y();
  421. if ( y > h ) y = y - h - 10; else y = y + 10;
  422. QPoint point = QPoint(x, y) + rect.topLeft();
  423. noteView().hint(element, QRect(point, size));
  424. }
  425. void FbTextEdit::load(const QString &filename, const QString &xml)
  426. {
  427. if (m_thread) return;
  428. m_thread = new FbReadThread(this, filename, xml);
  429. FbTextPage *page = new FbTextPage(m_thread);
  430. m_thread->setPage(page);
  431. m_thread->setTemp(page->temp());
  432. m_thread->start();
  433. }
  434. void FbTextEdit::html(QString html)
  435. {
  436. if (!m_thread) return;
  437. static int number = 0;
  438. QWebSettings::clearMemoryCaches();
  439. QUrl url(QString("fb2:/%1/").arg(number++));
  440. FbTextPage *page = m_thread->page();
  441. setPage(page);
  442. page->setParent(this);
  443. page->temp()->setPath(url.path());
  444. setHtml(html, url);
  445. connect(page, SIGNAL(linkHovered(QString,QString,QString)), SLOT(linkHovered(QString,QString,QString)));
  446. m_thread->deleteLater();
  447. m_thread = 0;
  448. }
  449. bool FbTextEdit::save(QIODevice *device, const QString &codec)
  450. {
  451. FbSaveWriter writer(*this, device);
  452. if (!codec.isEmpty()) writer.setCodec(codec.toLatin1());
  453. bool ok = FbSaveHandler(writer).save();
  454. if (ok) page()->undoStack()->setClean();
  455. return ok;
  456. }
  457. bool FbTextEdit::save(QByteArray *array)
  458. {
  459. FbSaveWriter writer(*this, array);
  460. return FbSaveHandler(writer).save();
  461. }
  462. bool FbTextEdit::save(QString *string)
  463. {
  464. // Use class QByteArray instead QString
  465. // to store information about encoding.
  466. QByteArray data;
  467. bool ok = save(&data);
  468. if (ok) *string = QString::fromUtf8(data.data());
  469. return ok;
  470. }
  471. void FbTextEdit::data(QString name, QByteArray data)
  472. {
  473. files()->data(name, data);
  474. }
  475. void FbTextEdit::zoomIn()
  476. {
  477. qreal zoom = zoomFactor();
  478. setZoomFactor(zoom * 1.1);
  479. }
  480. void FbTextEdit::zoomOut()
  481. {
  482. qreal zoom = zoomFactor();
  483. setZoomFactor(zoom * 0.9);
  484. }
  485. void FbTextEdit::zoomReset()
  486. {
  487. setZoomFactor(1);
  488. }
  489. bool FbTextEdit::UndoEnabled()
  490. {
  491. return pageAction(QWebPage::Undo)->isEnabled();
  492. }
  493. bool FbTextEdit::RedoEnabled()
  494. {
  495. return pageAction(QWebPage::Redo)->isEnabled();
  496. }
  497. bool FbTextEdit::CutEnabled()
  498. {
  499. return pageAction(QWebPage::Cut)->isEnabled();
  500. }
  501. bool FbTextEdit::CopyEnabled()
  502. {
  503. return pageAction(QWebPage::Copy)->isEnabled();
  504. }
  505. bool FbTextEdit::BoldChecked()
  506. {
  507. return pageAction(QWebPage::ToggleBold)->isChecked();
  508. }
  509. bool FbTextEdit::ItalicChecked()
  510. {
  511. return pageAction(QWebPage::ToggleItalic)->isChecked();
  512. }
  513. bool FbTextEdit::StrikeChecked()
  514. {
  515. return pageAction(QWebPage::ToggleStrikethrough)->isChecked();
  516. }
  517. bool FbTextEdit::SubChecked()
  518. {
  519. return pageAction(QWebPage::ToggleSubscript)->isChecked();
  520. }
  521. bool FbTextEdit::SupChecked()
  522. {
  523. return pageAction(QWebPage::ToggleSuperscript)->isChecked();
  524. }
  525. void FbTextEdit::find()
  526. {
  527. FbTextFindDlg dlg(*this);
  528. dlg.exec();
  529. }
  530. void FbTextEdit::insertImage()
  531. {
  532. QString filters;
  533. filters += tr("Common Graphics (*.png *.jpg *.jpeg *.gif);;");
  534. filters += tr("Portable Network Graphics (PNG) (*.png);;");
  535. filters += tr("JPEG (*.jpg *.jpeg);;");
  536. filters += tr("Graphics Interchange Format (*.gif);;");
  537. filters += tr("All Files (*)");
  538. QString path = QFileDialog::getOpenFileName(this, tr("Insert image..."), QString(), filters);
  539. if (path.isEmpty()) return;
  540. QFile file(path);
  541. if (!file.open(QIODevice::ReadOnly)) return;
  542. QByteArray data = file.readAll();
  543. QString name = files()->add(path, data);
  544. execCommand("insertImage", name.prepend("#"));
  545. }
  546. void FbTextEdit::insertNote()
  547. {
  548. FbNoteDlg dlg(*this);
  549. dlg.exec();
  550. }
  551. void FbTextEdit::insertLink()
  552. {
  553. bool ok;
  554. QString text = QInputDialog::getText(this, tr("Insert hyperlink"), tr("URL:"), QLineEdit::Normal, QString(), &ok);
  555. if (ok && !text.isEmpty()) execCommand("CreateLink", text);
  556. }
  557. void FbTextEdit::execCommand(const QString &cmd, const QString &arg)
  558. {
  559. QString javascript = QString("document.execCommand(\"%1\",false,\"%2\")").arg(cmd).arg(arg);
  560. page()->mainFrame()->evaluateJavaScript(javascript);
  561. }
  562. //---------------------------------------------------------------------------
  563. // FbTextFrame
  564. //---------------------------------------------------------------------------
  565. FbTextFrame::FbTextFrame(QWidget* parent)
  566. : QFrame(parent)
  567. , m_view(this)
  568. , m_dock(0)
  569. {
  570. setFrameShape(QFrame::StyledPanel);
  571. setFrameShadow(QFrame::Sunken);
  572. QLayout * layout = new QBoxLayout(QBoxLayout::LeftToRight, this);
  573. layout->setSpacing(0);
  574. layout->setMargin(0);
  575. layout->addWidget(&m_view);
  576. }
  577. FbTextFrame::~FbTextFrame()
  578. {
  579. if (m_dock) m_dock->deleteLater();
  580. }
  581. void FbTextFrame::showInspector()
  582. {
  583. if (m_dock) {
  584. m_dock->setVisible(m_dock->isHidden());
  585. return;
  586. }
  587. QMainWindow *main = qobject_cast<QMainWindow*>(parent());
  588. if (!main) return;
  589. m_dock = new QDockWidget(tr("Web inspector"), this);
  590. m_dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
  591. main->addDockWidget(Qt::BottomDockWidgetArea, m_dock);
  592. QWebInspector *inspector = new QWebInspector(this);
  593. inspector->setPage(m_view.page());
  594. m_dock->setWidget(inspector);
  595. connect(m_dock, SIGNAL(destroyed()), SLOT(dockDestroyed()));
  596. }
  597. void FbTextFrame::hideInspector()
  598. {
  599. if (m_dock) m_dock->hide();
  600. }
  601. void FbTextFrame::dockDestroyed()
  602. {
  603. m_dock = 0;
  604. }