author | pohly <pohly> | 2005-05-08 16:13:24 (UTC) |
---|---|---|
committer | pohly <pohly> | 2005-05-08 16:13:24 (UTC) |
commit | ea889d21f3b5bf846ff20a6fad9a756108a28ad7 (patch) (unidiff) | |
tree | 3d0462ccf147fb95886657d8bb610caa168e01ea | |
parent | 2ccb0ad8b77eb3c62914f5df5b1bba3becb83617 (diff) | |
download | opie-ea889d21f3b5bf846ff20a6fad9a756108a28ad7.zip opie-ea889d21f3b5bf846ff20a6fad9a756108a28ad7.tar.gz opie-ea889d21f3b5bf846ff20a6fad9a756108a28ad7.tar.bz2 |
code change by tim: ask the user to confirm the remapping of the ESC key
-rw-r--r-- | noncore/apps/opie-reader/QTReaderApp.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp index 6753698..8ef0674 100644 --- a/noncore/apps/opie-reader/QTReaderApp.cpp +++ b/noncore/apps/opie-reader/QTReaderApp.cpp | |||
@@ -1625,3073 +1625,3078 @@ void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) | |||
1625 | { | 1625 | { |
1626 | int info; | 1626 | int info; |
1627 | stream >> info; | 1627 | stream >> info; |
1628 | onespace(info); | 1628 | onespace(info); |
1629 | } | 1629 | } |
1630 | else if ( msg == "Layout/Repalm(int)" ) | 1630 | else if ( msg == "Layout/Repalm(int)" ) |
1631 | { | 1631 | { |
1632 | int info; | 1632 | int info; |
1633 | stream >> info; | 1633 | stream >> info; |
1634 | repalm(info); | 1634 | repalm(info); |
1635 | } | 1635 | } |
1636 | else if ( msg == "Layout/Unindent(int)" ) | 1636 | else if ( msg == "Layout/Unindent(int)" ) |
1637 | { | 1637 | { |
1638 | int info; | 1638 | int info; |
1639 | stream >> info; | 1639 | stream >> info; |
1640 | unindent(info); | 1640 | unindent(info); |
1641 | } | 1641 | } |
1642 | else if ( msg == "Layout/Re-paragraph(int)" ) | 1642 | else if ( msg == "Layout/Re-paragraph(int)" ) |
1643 | { | 1643 | { |
1644 | int info; | 1644 | int info; |
1645 | stream >> info; | 1645 | stream >> info; |
1646 | repara(info); | 1646 | repara(info); |
1647 | } | 1647 | } |
1648 | else if ( msg == "Layout/DoubleSpace(int)" ) | 1648 | else if ( msg == "Layout/DoubleSpace(int)" ) |
1649 | { | 1649 | { |
1650 | int info; | 1650 | int info; |
1651 | stream >> info; | 1651 | stream >> info; |
1652 | dblspce(info); | 1652 | dblspce(info); |
1653 | } | 1653 | } |
1654 | else if ( msg == "Layout/Indent(int)" ) | 1654 | else if ( msg == "Layout/Indent(int)" ) |
1655 | { | 1655 | { |
1656 | int info; | 1656 | int info; |
1657 | stream >> info; | 1657 | stream >> info; |
1658 | reader->bindenter = info; | 1658 | reader->bindenter = info; |
1659 | reader->setfilter(reader->getfilter()); | 1659 | reader->setfilter(reader->getfilter()); |
1660 | } | 1660 | } |
1661 | else if ( msg == "Layout/Remap(int)" ) | 1661 | else if ( msg == "Layout/Remap(int)" ) |
1662 | { | 1662 | { |
1663 | int info; | 1663 | int info; |
1664 | stream >> info; | 1664 | stream >> info; |
1665 | remap(info); | 1665 | remap(info); |
1666 | } | 1666 | } |
1667 | else if ( msg == "Layout/Embolden(int)" ) | 1667 | else if ( msg == "Layout/Embolden(int)" ) |
1668 | { | 1668 | { |
1669 | int info; | 1669 | int info; |
1670 | stream >> info; | 1670 | stream >> info; |
1671 | embolden(info); | 1671 | embolden(info); |
1672 | } | 1672 | } |
1673 | else if ( msg == "Format/Ideogram/Word(int)" ) | 1673 | else if ( msg == "Format/Ideogram/Word(int)" ) |
1674 | { | 1674 | { |
1675 | int info; | 1675 | int info; |
1676 | stream >> info; | 1676 | stream >> info; |
1677 | monospace(info); | 1677 | monospace(info); |
1678 | } | 1678 | } |
1679 | else if ( msg == "Format/SetWidth(int)" ) | 1679 | else if ( msg == "Format/SetWidth(int)" ) |
1680 | { | 1680 | { |
1681 | int info; | 1681 | int info; |
1682 | stream >> info; | 1682 | stream >> info; |
1683 | reader->m_charpc = info; | 1683 | reader->m_charpc = info; |
1684 | reader->setfont(); | 1684 | reader->setfont(); |
1685 | reader->refresh(); | 1685 | reader->refresh(); |
1686 | } | 1686 | } |
1687 | else if ( msg == "Format/SetFont(QString,int)" ) | 1687 | else if ( msg == "Format/SetFont(QString,int)" ) |
1688 | { | 1688 | { |
1689 | QString fontname; | 1689 | QString fontname; |
1690 | int size; | 1690 | int size; |
1691 | stream >> fontname; | 1691 | stream >> fontname; |
1692 | stream >> size; | 1692 | stream >> size; |
1693 | setfontHelper(fontname, size); | 1693 | setfontHelper(fontname, size); |
1694 | } | 1694 | } |
1695 | else if ( msg == "Marks/Autogen(QString)" ) | 1695 | else if ( msg == "Marks/Autogen(QString)" ) |
1696 | { | 1696 | { |
1697 | QString info; | 1697 | QString info; |
1698 | stream >> info; | 1698 | stream >> info; |
1699 | do_autogen(info); | 1699 | do_autogen(info); |
1700 | } | 1700 | } |
1701 | else if ( msg == "File/StartBlock()" ) | 1701 | else if ( msg == "File/StartBlock()" ) |
1702 | { | 1702 | { |
1703 | editMark(); | 1703 | editMark(); |
1704 | } | 1704 | } |
1705 | else if ( msg == "File/CopyBlock()" ) | 1705 | else if ( msg == "File/CopyBlock()" ) |
1706 | { | 1706 | { |
1707 | editCopy(); | 1707 | editCopy(); |
1708 | } | 1708 | } |
1709 | */ | 1709 | */ |
1710 | #endif | 1710 | #endif |
1711 | } | 1711 | } |
1712 | 1712 | ||
1713 | ActionTypes QTReaderApp::ActNameToInt(const QString& _enc) | 1713 | ActionTypes QTReaderApp::ActNameToInt(const QString& _enc) |
1714 | { | 1714 | { |
1715 | for (int i = 0; i < MAX_ACTIONS; i++) | 1715 | for (int i = 0; i < MAX_ACTIONS; i++) |
1716 | { | 1716 | { |
1717 | if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i; | 1717 | if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i; |
1718 | } | 1718 | } |
1719 | return cesAutoScroll; | 1719 | return cesAutoScroll; |
1720 | } | 1720 | } |
1721 | 1721 | ||
1722 | void QTReaderApp::setinverted(bool sfs) | 1722 | void QTReaderApp::setinverted(bool sfs) |
1723 | { | 1723 | { |
1724 | reader->setInverse(sfs); | 1724 | reader->setInverse(sfs); |
1725 | reader->setfilter(reader->getfilter()); | 1725 | reader->setfilter(reader->getfilter()); |
1726 | reader->refresh(); | 1726 | reader->refresh(); |
1727 | } | 1727 | } |
1728 | 1728 | ||
1729 | void QTReaderApp::setrotated(bool sfs) | 1729 | void QTReaderApp::setrotated(bool sfs) |
1730 | { | 1730 | { |
1731 | reader->setrotated(sfs); | 1731 | reader->setrotated(sfs); |
1732 | if (sfs) | 1732 | if (sfs) |
1733 | { | 1733 | { |
1734 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::BottomToTop : QBoxLayout::TopToBottom ); | 1734 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::BottomToTop : QBoxLayout::TopToBottom ); |
1735 | if (m_scrollbar != NULL) | 1735 | if (m_scrollbar != NULL) |
1736 | { | 1736 | { |
1737 | scrollbar->disconnect(); | 1737 | scrollbar->disconnect(); |
1738 | m_scrollbar->setOrientation(Qt::Horizontal); | 1738 | m_scrollbar->setOrientation(Qt::Horizontal); |
1739 | connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineUp()) ); | 1739 | connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineUp()) ); |
1740 | connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineDown()) ); | 1740 | connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineDown()) ); |
1741 | connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopageup()) ); | 1741 | connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopageup()) ); |
1742 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopagedn()) ); | 1742 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopagedn()) ); |
1743 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); | 1743 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); |
1744 | } | 1744 | } |
1745 | //reader->repaint(0, reader->m_left_border, reader->width(), reader->height()-2*reader->m_border); | 1745 | //reader->repaint(0, reader->m_left_border, reader->width(), reader->height()-2*reader->m_border); |
1746 | } | 1746 | } |
1747 | else | 1747 | else |
1748 | { | 1748 | { |
1749 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::RightToLeft : QBoxLayout::LeftToRight ); | 1749 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::RightToLeft : QBoxLayout::LeftToRight ); |
1750 | if (m_scrollbar != NULL) | 1750 | if (m_scrollbar != NULL) |
1751 | { | 1751 | { |
1752 | scrollbar->disconnect(); | 1752 | scrollbar->disconnect(); |
1753 | m_scrollbar->setOrientation(Qt::Vertical); | 1753 | m_scrollbar->setOrientation(Qt::Vertical); |
1754 | connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineDown()) ); | 1754 | connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineDown()) ); |
1755 | connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineUp()) ); | 1755 | connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineUp()) ); |
1756 | connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopagedn()) ); | 1756 | connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopagedn()) ); |
1757 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopageup()) ); | 1757 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopageup()) ); |
1758 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); | 1758 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); |
1759 | } | 1759 | } |
1760 | //reader->repaint(reader->m_border, 0, reader->width()-2*reader->m_border, reader->height()); | 1760 | //reader->repaint(reader->m_border, 0, reader->width()-2*reader->m_border, reader->height()); |
1761 | } | 1761 | } |
1762 | reader->refresh(); | 1762 | reader->refresh(); |
1763 | } | 1763 | } |
1764 | 1764 | ||
1765 | void QTReaderApp::setgrab(bool sfs) | 1765 | void QTReaderApp::setgrab(bool sfs) |
1766 | { | 1766 | { |
1767 | #ifdef USEQPE | 1767 | #ifdef USEQPE |
1768 | m_grabkeyboard = sfs; | 1768 | m_grabkeyboard = sfs; |
1769 | if (m_grabkeyboard) | 1769 | if (m_grabkeyboard) |
1770 | { | 1770 | { |
1771 | ((QPEApplication*)qApp)->grabKeyboard(); | 1771 | ((QPEApplication*)qApp)->grabKeyboard(); |
1772 | } | 1772 | } |
1773 | else | 1773 | else |
1774 | { | 1774 | { |
1775 | ((QPEApplication*)qApp)->ungrabKeyboard(); | 1775 | ((QPEApplication*)qApp)->ungrabKeyboard(); |
1776 | } | 1776 | } |
1777 | #endif | 1777 | #endif |
1778 | } | 1778 | } |
1779 | 1779 | ||
1780 | void QTReaderApp::setfullscreen(bool sfs) | 1780 | void QTReaderApp::setfullscreen(bool sfs) |
1781 | { | 1781 | { |
1782 | reader->bDoUpdates = false; | 1782 | reader->bDoUpdates = false; |
1783 | m_fullscreen = sfs; | 1783 | m_fullscreen = sfs; |
1784 | showEditTools(); | 1784 | showEditTools(); |
1785 | // qApp->processEvents(); | 1785 | // qApp->processEvents(); |
1786 | reader->bDoUpdates = true; | 1786 | reader->bDoUpdates = true; |
1787 | reader->update(); | 1787 | reader->update(); |
1788 | } | 1788 | } |
1789 | /* | 1789 | /* |
1790 | void QTReaderApp::buttonActionSelected(QAction* _a) | 1790 | void QTReaderApp::buttonActionSelected(QAction* _a) |
1791 | { | 1791 | { |
1792 | //// qDebug("es:%x : %s (%u)", _a, (const char *)(_a->text()), ActNameToInt(_a->text())); | 1792 | //// qDebug("es:%x : %s (%u)", _a, (const char *)(_a->text()), ActNameToInt(_a->text())); |
1793 | m_spaceTarget = ActNameToInt(_a->text()); | 1793 | m_spaceTarget = ActNameToInt(_a->text()); |
1794 | } | 1794 | } |
1795 | */ | 1795 | */ |
1796 | QTReaderApp::~QTReaderApp() | 1796 | QTReaderApp::~QTReaderApp() |
1797 | { | 1797 | { |
1798 | } | 1798 | } |
1799 | 1799 | ||
1800 | void QTReaderApp::autoScroll(bool _b) | 1800 | void QTReaderApp::autoScroll(bool _b) |
1801 | { | 1801 | { |
1802 | reader->setautoscroll(_b); | 1802 | reader->setautoscroll(_b); |
1803 | setScrollState(reader->m_autoScroll); | 1803 | setScrollState(reader->m_autoScroll); |
1804 | } | 1804 | } |
1805 | 1805 | ||
1806 | void QTReaderApp::zoomin() | 1806 | void QTReaderApp::zoomin() |
1807 | { | 1807 | { |
1808 | reader->zoomin(); | 1808 | reader->zoomin(); |
1809 | QFont f(reader->m_fontname, reader->m_fontControl.getsize(0)); | 1809 | QFont f(reader->m_fontname, reader->m_fontControl.getsize(0)); |
1810 | m_prog->setFont( f ); | 1810 | m_prog->setFont( f ); |
1811 | } | 1811 | } |
1812 | 1812 | ||
1813 | void QTReaderApp::zoomout() | 1813 | void QTReaderApp::zoomout() |
1814 | { | 1814 | { |
1815 | reader->zoomout(); | 1815 | reader->zoomout(); |
1816 | QFont f(reader->m_fontname, reader->m_fontControl.getsize(0)); | 1816 | QFont f(reader->m_fontname, reader->m_fontControl.getsize(0)); |
1817 | m_prog->setFont( f ); | 1817 | m_prog->setFont( f ); |
1818 | } | 1818 | } |
1819 | 1819 | ||
1820 | void QTReaderApp::clearBkmkList() | 1820 | void QTReaderApp::clearBkmkList() |
1821 | { | 1821 | { |
1822 | delete pBkmklist; | 1822 | delete pBkmklist; |
1823 | reader->pBkmklist = pBkmklist = NULL; | 1823 | reader->pBkmklist = pBkmklist = NULL; |
1824 | m_fBkmksChanged = false; | 1824 | m_fBkmksChanged = false; |
1825 | reader->refresh(true); | 1825 | reader->refresh(true); |
1826 | } | 1826 | } |
1827 | 1827 | ||
1828 | void QTReaderApp::fileClose() | 1828 | void QTReaderApp::fileClose() |
1829 | { | 1829 | { |
1830 | CCloseDialog* cd = new CCloseDialog(reader->m_string, false, this); | 1830 | CCloseDialog* cd = new CCloseDialog(reader->m_string, false, this); |
1831 | if (cd->exec()) | 1831 | if (cd->exec()) |
1832 | { | 1832 | { |
1833 | if (pOpenlist != NULL) | 1833 | if (pOpenlist != NULL) |
1834 | { | 1834 | { |
1835 | int ind = 0; | 1835 | int ind = 0; |
1836 | Bkmk* p = (*pOpenlist)[ind]; | 1836 | Bkmk* p = (*pOpenlist)[ind]; |
1837 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) | 1837 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) |
1838 | { | 1838 | { |
1839 | p = (*pOpenlist)[++ind]; | 1839 | p = (*pOpenlist)[++ind]; |
1840 | } | 1840 | } |
1841 | if (p != NULL) pOpenlist->erase(ind); | 1841 | if (p != NULL) pOpenlist->erase(ind); |
1842 | if (cd->delFile()) | 1842 | if (cd->delFile()) |
1843 | { | 1843 | { |
1844 | unlink((const char*)reader->m_lastfile); | 1844 | unlink((const char*)reader->m_lastfile); |
1845 | } | 1845 | } |
1846 | if (cd->delMarks()) | 1846 | if (cd->delMarks()) |
1847 | { | 1847 | { |
1848 | #ifndef USEQPE | 1848 | #ifndef USEQPE |
1849 | QDir d = QDir::home(); // "/" | 1849 | QDir d = QDir::home(); // "/" |
1850 | d.cd(APPDIR); | 1850 | d.cd(APPDIR); |
1851 | d.remove(reader->m_string); | 1851 | d.remove(reader->m_string); |
1852 | #else /* USEQPE */ | 1852 | #else /* USEQPE */ |
1853 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); | 1853 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); |
1854 | #endif /* USEQPE */ | 1854 | #endif /* USEQPE */ |
1855 | } | 1855 | } |
1856 | if (cd->delConfig()) | 1856 | if (cd->delConfig()) |
1857 | { | 1857 | { |
1858 | #ifndef USEQPE | 1858 | #ifndef USEQPE |
1859 | QDir d = QDir::home(); // "/" | 1859 | QDir d = QDir::home(); // "/" |
1860 | d.cd(APPDIR "/configs"); | 1860 | d.cd(APPDIR "/configs"); |
1861 | d.remove(reader->m_string); | 1861 | d.remove(reader->m_string); |
1862 | #else /* USEQPE */ | 1862 | #else /* USEQPE */ |
1863 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",reader->m_string)); | 1863 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",reader->m_string)); |
1864 | #endif /* USEQPE */ | 1864 | #endif /* USEQPE */ |
1865 | } | 1865 | } |
1866 | } | 1866 | } |
1867 | 1867 | ||
1868 | fileOpen2(); | 1868 | fileOpen2(); |
1869 | } | 1869 | } |
1870 | delete cd; | 1870 | delete cd; |
1871 | } | 1871 | } |
1872 | 1872 | ||
1873 | void QTReaderApp::updatefileinfo() | 1873 | void QTReaderApp::updatefileinfo() |
1874 | { | 1874 | { |
1875 | if (reader->m_string.isEmpty()) return; | 1875 | if (reader->m_string.isEmpty()) return; |
1876 | if (reader->m_lastfile.isEmpty()) return; | 1876 | if (reader->m_lastfile.isEmpty()) return; |
1877 | tchar* nm = fromQString(reader->m_string); | 1877 | tchar* nm = fromQString(reader->m_string); |
1878 | tchar* fl = fromQString(reader->m_lastfile); | 1878 | tchar* fl = fromQString(reader->m_lastfile); |
1879 | // qDebug("Lastfile:%x", fl); | 1879 | // qDebug("Lastfile:%x", fl); |
1880 | bool notadded = true; | 1880 | bool notadded = true; |
1881 | if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>; | 1881 | if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>; |
1882 | else | 1882 | else |
1883 | { | 1883 | { |
1884 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) | 1884 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) |
1885 | { | 1885 | { |
1886 | if (ustrcmp(CFiledata(iter->anno()).name(), fl) == 0) | 1886 | if (ustrcmp(CFiledata(iter->anno()).name(), fl) == 0) |
1887 | { | 1887 | { |
1888 | iter->value(reader->pagelocate()); | 1888 | iter->value(reader->pagelocate()); |
1889 | unsigned short dlen; | 1889 | unsigned short dlen; |
1890 | unsigned char* data; | 1890 | unsigned char* data; |
1891 | CFiledata fd(iter->anno()); | 1891 | CFiledata fd(iter->anno()); |
1892 | reader->setSaveData(data, dlen, fd.content(), fd.length()); | 1892 | reader->setSaveData(data, dlen, fd.content(), fd.length()); |
1893 | // qDebug("Filedata(1):%u, %u", fd.length(), dlen); | 1893 | // qDebug("Filedata(1):%u, %u", fd.length(), dlen); |
1894 | // getstate(data, dlen); | 1894 | // getstate(data, dlen); |
1895 | iter->setAnno(data, dlen); | 1895 | iter->setAnno(data, dlen); |
1896 | notadded = false; | 1896 | notadded = false; |
1897 | delete [] data; | 1897 | delete [] data; |
1898 | break; | 1898 | break; |
1899 | } | 1899 | } |
1900 | } | 1900 | } |
1901 | } | 1901 | } |
1902 | // qDebug("Added?:%x", notadded); | 1902 | // qDebug("Added?:%x", notadded); |
1903 | if (notadded) | 1903 | if (notadded) |
1904 | { | 1904 | { |
1905 | struct stat fnstat; | 1905 | struct stat fnstat; |
1906 | stat((const char *)reader->m_lastfile, &fnstat); | 1906 | stat((const char *)reader->m_lastfile, &fnstat); |
1907 | CFiledata fd(fnstat.st_mtime, fl); | 1907 | CFiledata fd(fnstat.st_mtime, fl); |
1908 | unsigned short dlen; | 1908 | unsigned short dlen; |
1909 | unsigned char* data; | 1909 | unsigned char* data; |
1910 | reader->setSaveData(data, dlen, fd.content(), fd.length()); | 1910 | reader->setSaveData(data, dlen, fd.content(), fd.length()); |
1911 | pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate())); | 1911 | pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate())); |
1912 | //qDebug("Filedata(2):%u, %u", fd.length(), dlen); | 1912 | //qDebug("Filedata(2):%u, %u", fd.length(), dlen); |
1913 | delete [] data; | 1913 | delete [] data; |
1914 | } | 1914 | } |
1915 | delete [] nm; | 1915 | delete [] nm; |
1916 | delete [] fl; | 1916 | delete [] fl; |
1917 | } | 1917 | } |
1918 | 1918 | ||
1919 | void QTReaderApp::fileOpen() | 1919 | void QTReaderApp::fileOpen() |
1920 | { | 1920 | { |
1921 | /* | 1921 | /* |
1922 | menu->hide(); | 1922 | menu->hide(); |
1923 | fileBar->hide(); | 1923 | fileBar->hide(); |
1924 | if (regVisible) regBar->hide(); | 1924 | if (regVisible) regBar->hide(); |
1925 | if (searchVisible) searchBar->hide(); | 1925 | if (searchVisible) searchBar->hide(); |
1926 | */ | 1926 | */ |
1927 | // qDebug("fileOpen"); | 1927 | // qDebug("fileOpen"); |
1928 | // if (!reader->m_lastfile.isEmpty()) | 1928 | // if (!reader->m_lastfile.isEmpty()) |
1929 | updatefileinfo(); | 1929 | updatefileinfo(); |
1930 | fileOpen2(); | 1930 | fileOpen2(); |
1931 | } | 1931 | } |
1932 | 1932 | ||
1933 | void QTReaderApp::fileOpen2() | 1933 | void QTReaderApp::fileOpen2() |
1934 | { | 1934 | { |
1935 | if (pBkmklist != NULL) | 1935 | if (pBkmklist != NULL) |
1936 | { | 1936 | { |
1937 | if (m_fBkmksChanged) | 1937 | if (m_fBkmksChanged) |
1938 | { | 1938 | { |
1939 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) | 1939 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) |
1940 | savebkmks(); | 1940 | savebkmks(); |
1941 | } | 1941 | } |
1942 | delete pBkmklist; | 1942 | delete pBkmklist; |
1943 | reader->pBkmklist = pBkmklist = NULL; | 1943 | reader->pBkmklist = pBkmklist = NULL; |
1944 | m_fBkmksChanged = false; | 1944 | m_fBkmksChanged = false; |
1945 | } | 1945 | } |
1946 | reader->disableAutoscroll(); | 1946 | reader->disableAutoscroll(); |
1947 | /* | 1947 | /* |
1948 | editorStack->raiseWidget( fileSelector ); | 1948 | editorStack->raiseWidget( fileSelector ); |
1949 | fileSelector->reread(); | 1949 | fileSelector->reread(); |
1950 | */ | 1950 | */ |
1951 | bool usebrowser = true; | 1951 | bool usebrowser = true; |
1952 | if (pOpenlist != NULL) | 1952 | if (pOpenlist != NULL) |
1953 | { | 1953 | { |
1954 | m_nBkmkAction = cOpenFile; | 1954 | m_nBkmkAction = cOpenFile; |
1955 | if (listbkmk(pOpenlist, "Browse", true)) usebrowser = false; | 1955 | if (listbkmk(pOpenlist, "Browse", true)) usebrowser = false; |
1956 | } | 1956 | } |
1957 | if (usebrowser) | 1957 | if (usebrowser) |
1958 | { | 1958 | { |
1959 | QString fn = usefilebrowser(); | 1959 | QString fn = usefilebrowser(); |
1960 | //qApp->processEvents(); | 1960 | //qApp->processEvents(); |
1961 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) | 1961 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) |
1962 | { | 1962 | { |
1963 | openFile(fn); | 1963 | openFile(fn); |
1964 | } | 1964 | } |
1965 | reader->setFocus(); | 1965 | reader->setFocus(); |
1966 | } | 1966 | } |
1967 | // reader->refresh(); | 1967 | // reader->refresh(); |
1968 | // qDebug("HEIGHT:%d", reader->m_lastheight); | 1968 | // qDebug("HEIGHT:%d", reader->m_lastheight); |
1969 | } | 1969 | } |
1970 | 1970 | ||
1971 | QString QTReaderApp::usefilebrowser() | 1971 | QString QTReaderApp::usefilebrowser() |
1972 | { | 1972 | { |
1973 | #ifndef USEQPE | 1973 | #ifndef USEQPE |
1974 | QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) ); | 1974 | QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) ); |
1975 | return s; | 1975 | return s; |
1976 | #else | 1976 | #else |
1977 | QString fn; | 1977 | QString fn; |
1978 | #if defined(OPIE) && defined(OPIEFILEDIALOG) | 1978 | #if defined(OPIE) && defined(OPIEFILEDIALOG) |
1979 | QMap<QString, QStringList> mimeTypes; | 1979 | QMap<QString, QStringList> mimeTypes; |
1980 | QStringList etypes; | 1980 | QStringList etypes; |
1981 | etypes << "etext/*"; | 1981 | etypes << "etext/*"; |
1982 | mimeTypes.insert( tr("eText"), etypes ); | 1982 | mimeTypes.insert( tr("eText"), etypes ); |
1983 | QStringList types; | 1983 | QStringList types; |
1984 | types << "text/*"; | 1984 | types << "text/*"; |
1985 | mimeTypes.insert( tr("Text"), types ); | 1985 | mimeTypes.insert( tr("Text"), types ); |
1986 | mimeTypes.insert( tr("All"), "*/*" ); | 1986 | mimeTypes.insert( tr("All"), "*/*" ); |
1987 | fn = OFileDialog::getOpenFileName(OFileSelector::EXTENDED_ALL, QFileInfo(reader->m_lastfile).dirPath(true), QString::null, mimeTypes, 0, "OpieReader"); | 1987 | fn = OFileDialog::getOpenFileName(OFileSelector::EXTENDED_ALL, QFileInfo(reader->m_lastfile).dirPath(true), QString::null, mimeTypes, 0, "OpieReader"); |
1988 | #else | 1988 | #else |
1989 | fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog, | 1989 | fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog, |
1990 | 0, | 1990 | 0, |
1991 | // WStyle_Customize | WStyle_NoBorderEx, | 1991 | // WStyle_Customize | WStyle_NoBorderEx, |
1992 | "*", QFileInfo(reader->m_lastfile).dirPath(true)); | 1992 | "*", QFileInfo(reader->m_lastfile).dirPath(true)); |
1993 | 1993 | ||
1994 | 1994 | ||
1995 | if (fb->exec()) | 1995 | if (fb->exec()) |
1996 | { | 1996 | { |
1997 | fn = fb->getCurrentFile(); | 1997 | fn = fb->getCurrentFile(); |
1998 | } | 1998 | } |
1999 | // qDebug("Selected %s", (const char*)fn); | 1999 | // qDebug("Selected %s", (const char*)fn); |
2000 | delete fb; | 2000 | delete fb; |
2001 | #endif | 2001 | #endif |
2002 | showEditTools(); | 2002 | showEditTools(); |
2003 | return fn; | 2003 | return fn; |
2004 | #endif | 2004 | #endif |
2005 | } | 2005 | } |
2006 | 2006 | ||
2007 | void QTReaderApp::showgraphic(QImage& pm) | 2007 | void QTReaderApp::showgraphic(QImage& pm) |
2008 | { | 2008 | { |
2009 | m_graphicwin->setImage(pm); | 2009 | m_graphicwin->setImage(pm); |
2010 | editorStack->raiseWidget( m_graphicwin ); | 2010 | editorStack->raiseWidget( m_graphicwin ); |
2011 | hidetoolbars(); | 2011 | hidetoolbars(); |
2012 | m_graphicwin->setFocus(); | 2012 | m_graphicwin->setFocus(); |
2013 | } | 2013 | } |
2014 | 2014 | ||
2015 | void QTReaderApp::showbuttonprefs() | 2015 | void QTReaderApp::showbuttonprefs() |
2016 | { | 2016 | { |
2017 | editorStack->raiseWidget( m_buttonprefs ); | 2017 | editorStack->raiseWidget( m_buttonprefs ); |
2018 | hidetoolbars(); | 2018 | hidetoolbars(); |
2019 | m_buttonprefs->setFocus(); | 2019 | m_buttonprefs->setFocus(); |
2020 | m_kmapchanged = true; | 2020 | m_kmapchanged = true; |
2021 | } | 2021 | } |
2022 | 2022 | ||
2023 | void QTReaderApp::showprefs() | 2023 | void QTReaderApp::showprefs() |
2024 | { | 2024 | { |
2025 | CPrefs* prefwin = new CPrefs(reader->width(), !m_bFloatingDialog, this); | 2025 | CPrefs* prefwin = new CPrefs(reader->width(), !m_bFloatingDialog, this); |
2026 | 2026 | ||
2027 | // prefwin->Debounce(m_debounce); | 2027 | // prefwin->Debounce(m_debounce); |
2028 | prefwin->bgtype(m_bgtype); | 2028 | prefwin->bgtype(m_bgtype); |
2029 | prefwin->repalm(reader->brepalm); | 2029 | prefwin->repalm(reader->brepalm); |
2030 | prefwin->UnderlineLink(reader->bunderlineLink); | 2030 | prefwin->UnderlineLink(reader->bunderlineLink); |
2031 | prefwin->kern(reader->bkern); | 2031 | prefwin->kern(reader->bkern); |
2032 | prefwin->hyphenate(reader->hyphenate); | 2032 | prefwin->hyphenate(reader->hyphenate); |
2033 | // prefwin->customhyphen(reader->buffdoc.getCustomHyphen()); | 2033 | // prefwin->customhyphen(reader->buffdoc.getCustomHyphen()); |
2034 | prefwin->scrolltype(reader->m_scrolltype); | 2034 | prefwin->scrolltype(reader->m_scrolltype); |
2035 | prefwin->scrollstep(reader->m_scrollstep); | 2035 | prefwin->scrollstep(reader->m_scrollstep); |
2036 | prefwin->scrollcolor(m_scrollcolor); | 2036 | prefwin->scrollcolor(m_scrollcolor); |
2037 | prefwin->minibarcol(m_scrollbarcolor); | 2037 | prefwin->minibarcol(m_scrollbarcolor); |
2038 | prefwin->foreground(m_foreground); | 2038 | prefwin->foreground(m_foreground); |
2039 | prefwin->background(m_background); | 2039 | prefwin->background(m_background); |
2040 | prefwin->twotouch(m_twoTouch); | 2040 | prefwin->twotouch(m_twoTouch); |
2041 | prefwin->propfontchange(m_propogatefontchange); | 2041 | prefwin->propfontchange(m_propogatefontchange); |
2042 | prefwin->StripCR(reader->bstripcr); | 2042 | prefwin->StripCR(reader->bstripcr); |
2043 | prefwin->InlineTables(!reader->bNoInlineTables); | 2043 | prefwin->InlineTables(!reader->bNoInlineTables); |
2044 | prefwin->Dehyphen(reader->bdehyphen); | 2044 | prefwin->Dehyphen(reader->bdehyphen); |
2045 | prefwin->SingleSpace(reader->bonespace); | 2045 | prefwin->SingleSpace(reader->bonespace); |
2046 | prefwin->Unindent(reader->bunindent); | 2046 | prefwin->Unindent(reader->bunindent); |
2047 | prefwin->Reparagraph(reader->brepara); | 2047 | prefwin->Reparagraph(reader->brepara); |
2048 | prefwin->DoubleSpace(reader->bdblspce); | 2048 | prefwin->DoubleSpace(reader->bdblspce); |
2049 | prefwin->Remap(reader->bremap); | 2049 | prefwin->Remap(reader->bremap); |
2050 | prefwin->Embolden(reader->bmakebold); | 2050 | prefwin->Embolden(reader->bmakebold); |
2051 | prefwin->FullJustify(reader->bfulljust); | 2051 | prefwin->FullJustify(reader->bfulljust); |
2052 | // prefwin->Inverse(reader->bInverse); | 2052 | // prefwin->Inverse(reader->bInverse); |
2053 | // prefwin->Negative(reader->bNegative); | 2053 | // prefwin->Negative(reader->bNegative); |
2054 | prefwin->FixGraphics(reader->m_fontControl.FixGraphics()); | 2054 | prefwin->FixGraphics(reader->m_fontControl.FixGraphics()); |
2055 | prefwin->ParaLead(reader->getextraspace()); | 2055 | prefwin->ParaLead(reader->getextraspace()); |
2056 | prefwin->LineLead(reader->getlead()); | 2056 | prefwin->LineLead(reader->getlead()); |
2057 | prefwin->TopMargin(reader->m_abstopmargin); | 2057 | prefwin->TopMargin(reader->m_abstopmargin); |
2058 | prefwin->BottomMargin(reader->m_absbottommargin); | 2058 | prefwin->BottomMargin(reader->m_absbottommargin); |
2059 | prefwin->LeftMargin(reader->m_absleft_border); | 2059 | prefwin->LeftMargin(reader->m_absleft_border); |
2060 | prefwin->RightMargin(reader->m_absright_border); | 2060 | prefwin->RightMargin(reader->m_absright_border); |
2061 | prefwin->Indent(reader->bindenter); | 2061 | prefwin->Indent(reader->bindenter); |
2062 | if (reader->bautofmt) | 2062 | if (reader->bautofmt) |
2063 | { | 2063 | { |
2064 | prefwin->Markup(0); | 2064 | prefwin->Markup(0); |
2065 | } | 2065 | } |
2066 | else if (reader->btextfmt) | 2066 | else if (reader->btextfmt) |
2067 | { | 2067 | { |
2068 | prefwin->Markup(2); | 2068 | prefwin->Markup(2); |
2069 | } | 2069 | } |
2070 | else if (reader->bstriphtml) | 2070 | else if (reader->bstriphtml) |
2071 | { | 2071 | { |
2072 | prefwin->Markup(3); | 2072 | prefwin->Markup(3); |
2073 | } | 2073 | } |
2074 | else if (reader->bpeanut) | 2074 | else if (reader->bpeanut) |
2075 | { | 2075 | { |
2076 | prefwin->Markup(4); | 2076 | prefwin->Markup(4); |
2077 | } | 2077 | } |
2078 | else | 2078 | else |
2079 | { | 2079 | { |
2080 | prefwin->Markup(1); | 2080 | prefwin->Markup(1); |
2081 | } | 2081 | } |
2082 | prefwin->Depluck(reader->bdepluck); | 2082 | prefwin->Depluck(reader->bdepluck); |
2083 | prefwin->Dejpluck(reader->bdejpluck); | 2083 | prefwin->Dejpluck(reader->bdejpluck); |
2084 | prefwin->Continuous(reader->m_continuousDocument); | 2084 | prefwin->Continuous(reader->m_continuousDocument); |
2085 | prefwin->DoubleBuffer(reader->m_doubleBuffered); | 2085 | prefwin->DoubleBuffer(reader->m_doubleBuffered); |
2086 | 2086 | ||
2087 | prefwin->dictApplication(m_targetapp); | 2087 | prefwin->dictApplication(m_targetapp); |
2088 | prefwin->dictMessage(m_targetmsg); | 2088 | prefwin->dictMessage(m_targetmsg); |
2089 | 2089 | ||
2090 | /* | 2090 | /* |
2091 | prefwin->leftScroll(m_leftScroll); | 2091 | prefwin->leftScroll(m_leftScroll); |
2092 | prefwin->rightScroll(m_rightScroll); | 2092 | prefwin->rightScroll(m_rightScroll); |
2093 | prefwin->upScroll(m_upScroll); | 2093 | prefwin->upScroll(m_upScroll); |
2094 | prefwin->downScroll(m_downScroll); | 2094 | prefwin->downScroll(m_downScroll); |
2095 | */ | 2095 | */ |
2096 | 2096 | ||
2097 | prefwin->miscannotation(m_doAnnotation); | 2097 | prefwin->miscannotation(m_doAnnotation); |
2098 | prefwin->miscdictionary(m_doDictionary); | 2098 | prefwin->miscdictionary(m_doDictionary); |
2099 | prefwin->miscclipboard(m_doClipboard); | 2099 | prefwin->miscclipboard(m_doClipboard); |
2100 | prefwin->miscoutput(m_doOutput); | 2100 | prefwin->miscoutput(m_doOutput); |
2101 | 2101 | ||
2102 | prefwin->SwapMouse(reader->m_swapmouse); | 2102 | prefwin->SwapMouse(reader->m_swapmouse); |
2103 | 2103 | ||
2104 | prefwin->Font(reader->m_fontname); | 2104 | prefwin->Font(reader->m_fontname); |
2105 | 2105 | ||
2106 | prefwin->gfxsize(reader->getBaseSize()); | 2106 | prefwin->gfxsize(reader->getBaseSize()); |
2107 | 2107 | ||
2108 | prefwin->pageoverlap(reader->m_overlap); | 2108 | prefwin->pageoverlap(reader->m_overlap); |
2109 | 2109 | ||
2110 | prefwin->ideogram(reader->m_bMonoSpaced); | 2110 | prefwin->ideogram(reader->m_bMonoSpaced); |
2111 | 2111 | ||
2112 | prefwin->encoding(reader->m_encd); | 2112 | prefwin->encoding(reader->m_encd); |
2113 | 2113 | ||
2114 | prefwin->ideogramwidth(reader->m_charpc); | 2114 | prefwin->ideogramwidth(reader->m_charpc); |
2115 | 2115 | ||
2116 | prefwin->outcodec(reader->m_outputName); | 2116 | prefwin->outcodec(reader->m_outputName); |
2117 | 2117 | ||
2118 | if (prefwin->exec()) | 2118 | if (prefwin->exec()) |
2119 | { | 2119 | { |
2120 | // m_debounce = prefwin->Debounce(); | 2120 | // m_debounce = prefwin->Debounce(); |
2121 | reader->brepalm = prefwin->repalm(); | 2121 | reader->brepalm = prefwin->repalm(); |
2122 | reader->bunderlineLink = prefwin->UnderlineLink(); | 2122 | reader->bunderlineLink = prefwin->UnderlineLink(); |
2123 | 2123 | ||
2124 | reader->bkern = prefwin->kern(); | 2124 | reader->bkern = prefwin->kern(); |
2125 | reader->hyphenate = prefwin->hyphenate(); | 2125 | reader->hyphenate = prefwin->hyphenate(); |
2126 | // reader->buffdoc.setCustomHyphen(prefwin->customhyphen()); | 2126 | // reader->buffdoc.setCustomHyphen(prefwin->customhyphen()); |
2127 | reader->m_scrolltype = prefwin->scrolltype(); | 2127 | reader->m_scrolltype = prefwin->scrolltype(); |
2128 | reader->m_scrollstep = prefwin->scrollstep(); | 2128 | reader->m_scrollstep = prefwin->scrollstep(); |
2129 | m_scrollcolor = prefwin->scrollcolor(); | 2129 | m_scrollcolor = prefwin->scrollcolor(); |
2130 | setscrollcolour(); | 2130 | setscrollcolour(); |
2131 | m_scrollbarcolor = prefwin->minibarcol(); | 2131 | m_scrollbarcolor = prefwin->minibarcol(); |
2132 | setscrollbarcolour(); | 2132 | setscrollbarcolour(); |
2133 | m_foreground = prefwin->foreground(); | 2133 | m_foreground = prefwin->foreground(); |
2134 | reader->setForeground(getcolour(m_foreground)); | 2134 | reader->setForeground(getcolour(m_foreground)); |
2135 | m_background = prefwin->background(); | 2135 | m_background = prefwin->background(); |
2136 | reader->setBackground(getcolour(m_background)); | 2136 | reader->setBackground(getcolour(m_background)); |
2137 | m_twoTouch = prefwin->twotouch(); | 2137 | m_twoTouch = prefwin->twotouch(); |
2138 | reader->setTwoTouch(m_twoTouch); | 2138 | reader->setTwoTouch(m_twoTouch); |
2139 | m_touch_action->setOn(m_twoTouch); | 2139 | m_touch_action->setOn(m_twoTouch); |
2140 | 2140 | ||
2141 | reader->bstripcr = prefwin->StripCR(); | 2141 | reader->bstripcr = prefwin->StripCR(); |
2142 | reader->bNoInlineTables = !prefwin->InlineTables(); | 2142 | reader->bNoInlineTables = !prefwin->InlineTables(); |
2143 | reader->bdehyphen = prefwin->Dehyphen(); | 2143 | reader->bdehyphen = prefwin->Dehyphen(); |
2144 | reader->bonespace = prefwin->SingleSpace(); | 2144 | reader->bonespace = prefwin->SingleSpace(); |
2145 | reader->bunindent = prefwin->Unindent(); | 2145 | reader->bunindent = prefwin->Unindent(); |
2146 | reader->brepara = prefwin->Reparagraph(); | 2146 | reader->brepara = prefwin->Reparagraph(); |
2147 | reader->bdblspce = prefwin->DoubleSpace(); | 2147 | reader->bdblspce = prefwin->DoubleSpace(); |
2148 | reader->bremap = prefwin->Remap(); | 2148 | reader->bremap = prefwin->Remap(); |
2149 | reader->bmakebold = prefwin->Embolden(); | 2149 | reader->bmakebold = prefwin->Embolden(); |
2150 | reader->bfulljust = prefwin->FullJustify(); | 2150 | reader->bfulljust = prefwin->FullJustify(); |
2151 | //if (reader->bInverse != prefwin->Inverse()) reader->setInverse(prefwin->Inverse()); | 2151 | //if (reader->bInverse != prefwin->Inverse()) reader->setInverse(prefwin->Inverse()); |
2152 | //if (reader->bNegative != prefwin->Negative()) reader->setNegative(); | 2152 | //if (reader->bNegative != prefwin->Negative()) reader->setNegative(); |
2153 | reader->m_fontControl.FixGraphics(prefwin->FixGraphics()); | 2153 | reader->m_fontControl.FixGraphics(prefwin->FixGraphics()); |
2154 | 2154 | ||
2155 | reader->setextraspace(prefwin->ParaLead()); | 2155 | reader->setextraspace(prefwin->ParaLead()); |
2156 | reader->setlead(prefwin->LineLead()); | 2156 | reader->setlead(prefwin->LineLead()); |
2157 | reader->m_abstopmargin = prefwin->TopMargin(); | 2157 | reader->m_abstopmargin = prefwin->TopMargin(); |
2158 | reader->m_absbottommargin = prefwin->BottomMargin(); | 2158 | reader->m_absbottommargin = prefwin->BottomMargin(); |
2159 | reader->m_absleft_border = prefwin->LeftMargin(); | 2159 | reader->m_absleft_border = prefwin->LeftMargin(); |
2160 | reader->m_absright_border = prefwin->RightMargin(); | 2160 | reader->m_absright_border = prefwin->RightMargin(); |
2161 | reader->bindenter = prefwin->Indent(); | 2161 | reader->bindenter = prefwin->Indent(); |
2162 | reader->bautofmt = reader->btextfmt = reader->bstriphtml = reader->bpeanut = false; | 2162 | reader->bautofmt = reader->btextfmt = reader->bstriphtml = reader->bpeanut = false; |
2163 | switch (prefwin->Markup()) | 2163 | switch (prefwin->Markup()) |
2164 | { | 2164 | { |
2165 | case 0: | 2165 | case 0: |
2166 | reader->bautofmt = true; | 2166 | reader->bautofmt = true; |
2167 | break; | 2167 | break; |
2168 | case 1: | 2168 | case 1: |
2169 | break; | 2169 | break; |
2170 | case 2: | 2170 | case 2: |
2171 | reader->btextfmt = true; | 2171 | reader->btextfmt = true; |
2172 | break; | 2172 | break; |
2173 | case 3: | 2173 | case 3: |
2174 | reader->bstriphtml = true; | 2174 | reader->bstriphtml = true; |
2175 | break; | 2175 | break; |
2176 | case 4: | 2176 | case 4: |
2177 | reader->bpeanut = true; | 2177 | reader->bpeanut = true; |
2178 | break; | 2178 | break; |
2179 | default: | 2179 | default: |
2180 | qDebug("Format out of range"); | 2180 | qDebug("Format out of range"); |
2181 | } | 2181 | } |
2182 | reader->bdepluck = prefwin->Depluck(); | 2182 | reader->bdepluck = prefwin->Depluck(); |
2183 | reader->bdejpluck = prefwin->Dejpluck(); | 2183 | reader->bdejpluck = prefwin->Dejpluck(); |
2184 | reader->setContinuous(prefwin->Continuous()); | 2184 | reader->setContinuous(prefwin->Continuous()); |
2185 | reader->setDoubleBuffer(prefwin->DoubleBuffer()); | 2185 | reader->setDoubleBuffer(prefwin->DoubleBuffer()); |
2186 | 2186 | ||
2187 | /* | 2187 | /* |
2188 | m_leftScroll = prefwin->leftScroll(); | 2188 | m_leftScroll = prefwin->leftScroll(); |
2189 | m_rightScroll = prefwin->rightScroll(); | 2189 | m_rightScroll = prefwin->rightScroll(); |
2190 | m_upScroll = prefwin->upScroll(); | 2190 | m_upScroll = prefwin->upScroll(); |
2191 | m_downScroll = prefwin->downScroll(); | 2191 | m_downScroll = prefwin->downScroll(); |
2192 | */ | 2192 | */ |
2193 | m_targetapp = prefwin->dictApplication(); | 2193 | m_targetapp = prefwin->dictApplication(); |
2194 | m_targetmsg = prefwin->dictMessage(); | 2194 | m_targetmsg = prefwin->dictMessage(); |
2195 | 2195 | ||
2196 | m_doAnnotation = prefwin->miscannotation(); | 2196 | m_doAnnotation = prefwin->miscannotation(); |
2197 | m_doDictionary = prefwin->miscdictionary(); | 2197 | m_doDictionary = prefwin->miscdictionary(); |
2198 | m_doClipboard = prefwin->miscclipboard(); | 2198 | m_doClipboard = prefwin->miscclipboard(); |
2199 | m_doOutput = prefwin->miscoutput(); | 2199 | m_doOutput = prefwin->miscoutput(); |
2200 | reader->m_swapmouse = prefwin->SwapMouse(); | 2200 | reader->m_swapmouse = prefwin->SwapMouse(); |
2201 | reader->setBaseSize(prefwin->gfxsize()); | 2201 | reader->setBaseSize(prefwin->gfxsize()); |
2202 | reader->m_overlap = prefwin->pageoverlap(); | 2202 | reader->m_overlap = prefwin->pageoverlap(); |
2203 | reader->m_bMonoSpaced = prefwin->ideogram(); | 2203 | reader->m_bMonoSpaced = prefwin->ideogram(); |
2204 | m_setmono_action->setOn(reader->m_bMonoSpaced); | 2204 | m_setmono_action->setOn(reader->m_bMonoSpaced); |
2205 | reader->m_encd = prefwin->encoding(); | 2205 | reader->m_encd = prefwin->encoding(); |
2206 | reader->m_charpc = prefwin->ideogramwidth(); | 2206 | reader->m_charpc = prefwin->ideogramwidth(); |
2207 | 2207 | ||
2208 | if ( | 2208 | if ( |
2209 | reader->m_fontname != prefwin->Font() | 2209 | reader->m_fontname != prefwin->Font() |
2210 | || | 2210 | || |
2211 | m_propogatefontchange != prefwin->propfontchange()) | 2211 | m_propogatefontchange != prefwin->propfontchange()) |
2212 | { | 2212 | { |
2213 | m_propogatefontchange = prefwin->propfontchange(); | 2213 | m_propogatefontchange = prefwin->propfontchange(); |
2214 | setfontHelper(prefwin->Font()); | 2214 | setfontHelper(prefwin->Font()); |
2215 | } | 2215 | } |
2216 | if (m_bgtype != (bground)prefwin->bgtype()) | 2216 | if (m_bgtype != (bground)prefwin->bgtype()) |
2217 | { | 2217 | { |
2218 | m_bgtype = (bground)prefwin->bgtype(); | 2218 | m_bgtype = (bground)prefwin->bgtype(); |
2219 | setBackgroundBitmap(); | 2219 | setBackgroundBitmap(); |
2220 | } | 2220 | } |
2221 | qDebug("OutCodec:%s", (const char*)prefwin->outcodec()); | 2221 | qDebug("OutCodec:%s", (const char*)prefwin->outcodec()); |
2222 | if (reader->m_outputName != prefwin->outcodec()) | 2222 | if (reader->m_outputName != prefwin->outcodec()) |
2223 | { | 2223 | { |
2224 | if (reader->m_output != NULL) | 2224 | if (reader->m_output != NULL) |
2225 | { | 2225 | { |
2226 | QMessageBox::warning(this, PROGNAME, "Change of output codec\nrequires a restart"); | 2226 | QMessageBox::warning(this, PROGNAME, "Change of output codec\nrequires a restart"); |
2227 | } | 2227 | } |
2228 | reader->m_outputName = prefwin->outcodec(); | 2228 | reader->m_outputName = prefwin->outcodec(); |
2229 | } | 2229 | } |
2230 | delete prefwin; | 2230 | delete prefwin; |
2231 | reader->setfilter(reader->getfilter()); | 2231 | reader->setfilter(reader->getfilter()); |
2232 | reader->refresh(); | 2232 | reader->refresh(); |
2233 | } | 2233 | } |
2234 | else | 2234 | else |
2235 | { | 2235 | { |
2236 | delete prefwin; | 2236 | delete prefwin; |
2237 | } | 2237 | } |
2238 | } | 2238 | } |
2239 | 2239 | ||
2240 | void QTReaderApp::showtoolbarprefs() | 2240 | void QTReaderApp::showtoolbarprefs() |
2241 | { | 2241 | { |
2242 | #ifdef USEQPE | 2242 | #ifdef USEQPE |
2243 | CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this); | 2243 | CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this); |
2244 | #else | 2244 | #else |
2245 | QFileInfo fi; | 2245 | QFileInfo fi; |
2246 | QDir d = QDir::home(); // "/" | 2246 | QDir d = QDir::home(); // "/" |
2247 | if ( !d.cd(APPDIR) ) | 2247 | if ( !d.cd(APPDIR) ) |
2248 | { // "/tmp" | 2248 | { // "/tmp" |
2249 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); | 2249 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); |
2250 | d = QDir::home(); | 2250 | d = QDir::home(); |
2251 | d.mkdir(APPDIR); | 2251 | d.mkdir(APPDIR); |
2252 | d.cd(APPDIR); | 2252 | d.cd(APPDIR); |
2253 | } | 2253 | } |
2254 | fi.setFile(d, INIFILE); | 2254 | fi.setFile(d, INIFILE); |
2255 | CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this); | 2255 | CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this); |
2256 | #endif | 2256 | #endif |
2257 | prefwin->tbpolicy(m_tbpolsave); | 2257 | prefwin->tbpolicy(m_tbpolsave); |
2258 | prefwin->tbposition(m_tbposition-2); | 2258 | prefwin->tbposition(m_tbposition-2); |
2259 | prefwin->tbmovable(m_tbmovesave); | 2259 | prefwin->tbmovable(m_tbmovesave); |
2260 | prefwin->floating(m_bFloatingDialog); | 2260 | prefwin->floating(m_bFloatingDialog); |
2261 | prefwin->qtscroll(m_qtscroll); | 2261 | prefwin->qtscroll(m_qtscroll); |
2262 | prefwin->localscroll(m_localscroll); | 2262 | prefwin->localscroll(m_localscroll); |
2263 | if (prefwin->exec()) | 2263 | if (prefwin->exec()) |
2264 | { | 2264 | { |
2265 | m_bFloatingDialog = prefwin->floating(); | 2265 | m_bFloatingDialog = prefwin->floating(); |
2266 | if ( | 2266 | if ( |
2267 | m_tbpolsave != (ToolbarPolicy)prefwin->tbpolicy() | 2267 | m_tbpolsave != (ToolbarPolicy)prefwin->tbpolicy() |
2268 | || | 2268 | || |
2269 | m_tbposition != (ToolBarDock)(prefwin->tbposition()+2) | 2269 | m_tbposition != (ToolBarDock)(prefwin->tbposition()+2) |
2270 | || | 2270 | || |
2271 | m_tbmovesave != prefwin->tbmovable() | 2271 | m_tbmovesave != prefwin->tbmovable() |
2272 | || | 2272 | || |
2273 | m_qtscroll != prefwin->qtscroll() | 2273 | m_qtscroll != prefwin->qtscroll() |
2274 | // || | 2274 | // || |
2275 | // m_localscrollbar != prefwin->scrollonleft() | 2275 | // m_localscrollbar != prefwin->scrollonleft() |
2276 | ) | 2276 | ) |
2277 | { | 2277 | { |
2278 | QMessageBox::warning(this, PROGNAME, "Some changes won't take effect\nuntil the next time the\napplication is started"); | 2278 | QMessageBox::warning(this, PROGNAME, "Some changes won't take effect\nuntil the next time the\napplication is started"); |
2279 | } | 2279 | } |
2280 | m_tbpolsave = (ToolbarPolicy)prefwin->tbpolicy(); | 2280 | m_tbpolsave = (ToolbarPolicy)prefwin->tbpolicy(); |
2281 | m_tbposition = (ToolBarDock)(prefwin->tbposition()+2); | 2281 | m_tbposition = (ToolBarDock)(prefwin->tbposition()+2); |
2282 | m_tbmovesave = prefwin->tbmovable(); | 2282 | m_tbmovesave = prefwin->tbmovable(); |
2283 | reader->m_scrollpos = m_localscroll = prefwin->localscroll(); | 2283 | reader->m_scrollpos = m_localscroll = prefwin->localscroll(); |
2284 | if (m_qtscroll != prefwin->qtscroll()) | 2284 | if (m_qtscroll != prefwin->qtscroll()) |
2285 | { | 2285 | { |
2286 | m_qtscroll = prefwin->qtscroll(); | 2286 | m_qtscroll = prefwin->qtscroll(); |
2287 | setrotated(reader->m_rotated); | 2287 | setrotated(reader->m_rotated); |
2288 | } | 2288 | } |
2289 | if (m_scrollbar == NULL || m_scrollbar->isHidden()) | 2289 | if (m_scrollbar == NULL || m_scrollbar->isHidden()) |
2290 | { | 2290 | { |
2291 | reader->m_scrollpos = m_localscroll; | 2291 | reader->m_scrollpos = m_localscroll; |
2292 | } | 2292 | } |
2293 | else | 2293 | else |
2294 | { | 2294 | { |
2295 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; | 2295 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; |
2296 | } | 2296 | } |
2297 | bool isChanged = prefwin->isChanged(); | 2297 | bool isChanged = prefwin->isChanged(); |
2298 | delete prefwin; | 2298 | delete prefwin; |
2299 | #ifdef USEQPE | 2299 | #ifdef USEQPE |
2300 | Config config( APPDIR ); | 2300 | Config config( APPDIR ); |
2301 | #else | 2301 | #else |
2302 | QFileInfo fi; | 2302 | QFileInfo fi; |
2303 | QDir d = QDir::home(); // "/" | 2303 | QDir d = QDir::home(); // "/" |
2304 | if ( !d.cd(APPDIR) ) | 2304 | if ( !d.cd(APPDIR) ) |
2305 | { // "/tmp" | 2305 | { // "/tmp" |
2306 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); | 2306 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); |
2307 | d = QDir::home(); | 2307 | d = QDir::home(); |
2308 | d.mkdir(APPDIR); | 2308 | d.mkdir(APPDIR); |
2309 | d.cd(APPDIR); | 2309 | d.cd(APPDIR); |
2310 | } | 2310 | } |
2311 | fi.setFile(d, INIFILE); | 2311 | fi.setFile(d, INIFILE); |
2312 | Config config( fi.absFilePath() ); | 2312 | Config config( fi.absFilePath() ); |
2313 | #endif | 2313 | #endif |
2314 | if (isChanged) addtoolbars(&config); | 2314 | if (isChanged) addtoolbars(&config); |
2315 | } | 2315 | } |
2316 | else | 2316 | else |
2317 | { | 2317 | { |
2318 | delete prefwin; | 2318 | delete prefwin; |
2319 | } | 2319 | } |
2320 | } | 2320 | } |
2321 | 2321 | ||
2322 | void QTReaderApp::showinfo() | 2322 | void QTReaderApp::showinfo() |
2323 | { | 2323 | { |
2324 | unsigned long ds, fs, ts, pl, dl; | 2324 | unsigned long ds, fs, ts, pl, dl; |
2325 | if (reader->empty()) | 2325 | if (reader->empty()) |
2326 | { | 2326 | { |
2327 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); | 2327 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); |
2328 | } | 2328 | } |
2329 | else | 2329 | else |
2330 | { | 2330 | { |
2331 | reader->sizes(fs,ts); | 2331 | reader->sizes(fs,ts); |
2332 | ds = reader->buffdoc.endSection() - reader->buffdoc.startSection(); | 2332 | ds = reader->buffdoc.endSection() - reader->buffdoc.startSection(); |
2333 | pl = reader->pagelocate(); | 2333 | pl = reader->pagelocate(); |
2334 | dl = pl - reader->buffdoc.startSection(); | 2334 | dl = pl - reader->buffdoc.startSection(); |
2335 | m_infoWin->setFileSize(fs); | 2335 | m_infoWin->setFileSize(fs); |
2336 | m_infoWin->setTextSize(ts); | 2336 | m_infoWin->setTextSize(ts); |
2337 | if (fs > UINT_MAX/100) | 2337 | if (fs > UINT_MAX/100) |
2338 | { | 2338 | { |
2339 | unsigned long t1 = (ts+50)/100; | 2339 | unsigned long t1 = (ts+50)/100; |
2340 | m_infoWin->setRatio(100-(fs + (t1 >> 1))/t1); | 2340 | m_infoWin->setRatio(100-(fs + (t1 >> 1))/t1); |
2341 | } | 2341 | } |
2342 | else | 2342 | else |
2343 | { | 2343 | { |
2344 | m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); | 2344 | m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); |
2345 | } | 2345 | } |
2346 | m_infoWin->setLocation(pl); | 2346 | m_infoWin->setLocation(pl); |
2347 | if (pl > UINT_MAX/100) | 2347 | if (pl > UINT_MAX/100) |
2348 | { | 2348 | { |
2349 | unsigned long t1 = (ts+50)/100; | 2349 | unsigned long t1 = (ts+50)/100; |
2350 | m_infoWin->setRead((pl + (t1 >> 1))/t1); | 2350 | m_infoWin->setRead((pl + (t1 >> 1))/t1); |
2351 | } | 2351 | } |
2352 | else | 2352 | else |
2353 | { | 2353 | { |
2354 | m_infoWin->setRead((100*pl + (ts >> 1))/ts); | 2354 | m_infoWin->setRead((100*pl + (ts >> 1))/ts); |
2355 | } | 2355 | } |
2356 | m_infoWin->setDocSize(ds); | 2356 | m_infoWin->setDocSize(ds); |
2357 | m_infoWin->setDocLocation(dl); | 2357 | m_infoWin->setDocLocation(dl); |
2358 | if (dl > UINT_MAX/100) | 2358 | if (dl > UINT_MAX/100) |
2359 | { | 2359 | { |
2360 | unsigned long d1 = (ds+50)/100; | 2360 | unsigned long d1 = (ds+50)/100; |
2361 | m_infoWin->setDocRead((dl + (d1 >> 1))/d1); | 2361 | m_infoWin->setDocRead((dl + (d1 >> 1))/d1); |
2362 | } | 2362 | } |
2363 | else | 2363 | else |
2364 | { | 2364 | { |
2365 | m_infoWin->setDocRead((100*dl + (ds >> 1))/ds); | 2365 | m_infoWin->setDocRead((100*dl + (ds >> 1))/ds); |
2366 | } | 2366 | } |
2367 | m_infoWin->setZoom(reader->m_fontControl.currentsize()*10); | 2367 | m_infoWin->setZoom(reader->m_fontControl.currentsize()*10); |
2368 | m_infoWin->setAbout(QString("\nApplication (c) Tim Wentford\n")+reader->about()); | 2368 | m_infoWin->setAbout(QString("\nApplication (c) Tim Wentford\n")+reader->about()); |
2369 | editorStack->raiseWidget( m_infoWin ); | 2369 | editorStack->raiseWidget( m_infoWin ); |
2370 | hidetoolbars(); | 2370 | hidetoolbars(); |
2371 | m_infoWin->setFocus(); | 2371 | m_infoWin->setFocus(); |
2372 | } | 2372 | } |
2373 | } | 2373 | } |
2374 | 2374 | ||
2375 | void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn, size_t posn2) | 2375 | void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn, size_t posn2) |
2376 | { | 2376 | { |
2377 | if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>; | 2377 | if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>; |
2378 | #ifdef _UNICODE | 2378 | #ifdef _UNICODE |
2379 | CBuffer buff(name.length()+1); | 2379 | CBuffer buff(name.length()+1); |
2380 | int i; | 2380 | int i; |
2381 | for (i = 0; i < name.length(); i++) | 2381 | for (i = 0; i < name.length(); i++) |
2382 | { | 2382 | { |
2383 | buff[i] = name[i].unicode(); | 2383 | buff[i] = name[i].unicode(); |
2384 | } | 2384 | } |
2385 | buff[i] = 0; | 2385 | buff[i] = 0; |
2386 | CBuffer buff2(text.length()+1); | 2386 | CBuffer buff2(text.length()+1); |
2387 | for (i = 0; i < text.length(); i++) | 2387 | for (i = 0; i < text.length(); i++) |
2388 | { | 2388 | { |
2389 | buff2[i] = text[i].unicode(); | 2389 | buff2[i] = text[i].unicode(); |
2390 | } | 2390 | } |
2391 | buff2[i] = 0; | 2391 | buff2[i] = 0; |
2392 | Bkmk b(buff.data(), buff2.data(), posn, posn2); | 2392 | Bkmk b(buff.data(), buff2.data(), posn, posn2); |
2393 | QColor c = m_annoWin->getColor(); | 2393 | QColor c = m_annoWin->getColor(); |
2394 | int red,green,blue; | 2394 | int red,green,blue; |
2395 | c.rgb(&red, &green, &blue); | 2395 | c.rgb(&red, &green, &blue); |
2396 | b.red(red); | 2396 | b.red(red); |
2397 | b.green(green); | 2397 | b.green(green); |
2398 | b.blue(blue); | 2398 | b.blue(blue); |
2399 | pBkmklist->push_front(b); | 2399 | pBkmklist->push_front(b); |
2400 | #else | 2400 | #else |
2401 | pBkmklist->push_front(Bkmk((const tchar*)text,posn)); | 2401 | pBkmklist->push_front(Bkmk((const tchar*)text,posn)); |
2402 | #endif | 2402 | #endif |
2403 | m_fBkmksChanged = true; | 2403 | m_fBkmksChanged = true; |
2404 | pBkmklist->sort(); | 2404 | pBkmklist->sort(); |
2405 | } | 2405 | } |
2406 | 2406 | ||
2407 | void QTReaderApp::addAnno(const QString& name, const QString& text) | 2407 | void QTReaderApp::addAnno(const QString& name, const QString& text) |
2408 | { | 2408 | { |
2409 | if (m_annoIsEditing) | 2409 | if (m_annoIsEditing) |
2410 | { | 2410 | { |
2411 | if (name.isEmpty()) | 2411 | if (name.isEmpty()) |
2412 | { | 2412 | { |
2413 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nPlease try again", 1); | 2413 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nPlease try again", 1); |
2414 | } | 2414 | } |
2415 | else | 2415 | else |
2416 | { | 2416 | { |
2417 | addAnno(name, text, m_annoWin->getPosn(), m_annoWin->getPosn2()); | 2417 | addAnno(name, text, m_annoWin->getPosn(), m_annoWin->getPosn2()); |
2418 | } | 2418 | } |
2419 | showEditTools(); | 2419 | showEditTools(); |
2420 | } | 2420 | } |
2421 | else | 2421 | else |
2422 | { | 2422 | { |
2423 | if (m_annoWin->edited()) | 2423 | if (m_annoWin->edited()) |
2424 | { | 2424 | { |
2425 | CBuffer buff(text.length()+1); | 2425 | CBuffer buff(text.length()+1); |
2426 | int i; | 2426 | int i; |
2427 | for (i = 0; i < text.length(); i++) | 2427 | for (i = 0; i < text.length(); i++) |
2428 | { | 2428 | { |
2429 | buff[i] = text[i].unicode(); | 2429 | buff[i] = text[i].unicode(); |
2430 | } | 2430 | } |
2431 | buff[i] = 0; | 2431 | buff[i] = 0; |
2432 | m_fBkmksChanged = true; | 2432 | m_fBkmksChanged = true; |
2433 | m_anno->setAnno(buff.data()); | 2433 | m_anno->setAnno(buff.data()); |
2434 | } | 2434 | } |
2435 | QColor c = m_annoWin->getColor(); | 2435 | QColor c = m_annoWin->getColor(); |
2436 | int red,green,blue; | 2436 | int red,green,blue; |
2437 | c.rgb(&red, &green, &blue); | 2437 | c.rgb(&red, &green, &blue); |
2438 | m_anno->red(red); | 2438 | m_anno->red(red); |
2439 | m_anno->green(green); | 2439 | m_anno->green(green); |
2440 | m_anno->blue(blue); | 2440 | m_anno->blue(blue); |
2441 | bool found = findNextBookmark(m_anno->value()+1); | 2441 | bool found = findNextBookmark(m_anno->value()+1); |
2442 | if (found) | 2442 | if (found) |
2443 | { | 2443 | { |
2444 | m_annoWin->setName(toQString(m_anno->name())); | 2444 | m_annoWin->setName(toQString(m_anno->name())); |
2445 | m_annoWin->setAnno(toQString(m_anno->anno())); | 2445 | m_annoWin->setAnno(toQString(m_anno->anno())); |
2446 | m_annoWin->setColor(QColor(m_anno->red(), m_anno->green(), m_anno->blue())); | 2446 | m_annoWin->setColor(QColor(m_anno->red(), m_anno->green(), m_anno->blue())); |
2447 | } | 2447 | } |
2448 | else | 2448 | else |
2449 | { | 2449 | { |
2450 | showEditTools(); | 2450 | showEditTools(); |
2451 | } | 2451 | } |
2452 | } | 2452 | } |
2453 | } | 2453 | } |
2454 | 2454 | ||
2455 | bool QTReaderApp::findNextBookmark(size_t start) | 2455 | bool QTReaderApp::findNextBookmark(size_t start) |
2456 | { | 2456 | { |
2457 | bool found = false; | 2457 | bool found = false; |
2458 | for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++) | 2458 | for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++) |
2459 | { | 2459 | { |
2460 | if (iter->value() >= start) | 2460 | if (iter->value() >= start) |
2461 | { | 2461 | { |
2462 | if (iter->value() < reader->locate()) | 2462 | if (iter->value() < reader->locate()) |
2463 | { | 2463 | { |
2464 | found = true; | 2464 | found = true; |
2465 | m_anno = iter.pContent(); | 2465 | m_anno = iter.pContent(); |
2466 | } | 2466 | } |
2467 | break; | 2467 | break; |
2468 | } | 2468 | } |
2469 | } | 2469 | } |
2470 | return found; | 2470 | return found; |
2471 | } | 2471 | } |
2472 | 2472 | ||
2473 | void QTReaderApp::addanno() | 2473 | void QTReaderApp::addanno() |
2474 | { | 2474 | { |
2475 | if (reader->empty()) | 2475 | if (reader->empty()) |
2476 | { | 2476 | { |
2477 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); | 2477 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); |
2478 | } | 2478 | } |
2479 | else | 2479 | else |
2480 | { | 2480 | { |
2481 | m_annoWin->setName(""); | 2481 | m_annoWin->setName(""); |
2482 | m_annoWin->setAnno(""); | 2482 | m_annoWin->setAnno(""); |
2483 | m_annoWin->setPosn(reader->pagelocate()); | 2483 | m_annoWin->setPosn(reader->pagelocate()); |
2484 | m_annoIsEditing = true; | 2484 | m_annoIsEditing = true; |
2485 | editorStack->raiseWidget( m_annoWin ); | 2485 | editorStack->raiseWidget( m_annoWin ); |
2486 | hidetoolbars(); | 2486 | hidetoolbars(); |
2487 | #ifdef USEQPE | 2487 | #ifdef USEQPE |
2488 | Global::showInputMethod(); | 2488 | Global::showInputMethod(); |
2489 | #endif | 2489 | #endif |
2490 | m_annoWin->setFocus(); | 2490 | m_annoWin->setFocus(); |
2491 | } | 2491 | } |
2492 | } | 2492 | } |
2493 | 2493 | ||
2494 | void QTReaderApp::infoClose() | 2494 | void QTReaderApp::infoClose() |
2495 | { | 2495 | { |
2496 | m_debounce = m_buttonprefs->Debounce(); | 2496 | m_debounce = m_buttonprefs->Debounce(); |
2497 | if (m_kmapchanged) | 2497 | if (m_kmapchanged) |
2498 | { | 2498 | { |
2499 | m_kmapchanged = false; | 2499 | m_kmapchanged = false; |
2500 | #ifndef USEQPE | 2500 | #ifndef USEQPE |
2501 | QDir d = QDir::home(); // "/" | 2501 | QDir d = QDir::home(); // "/" |
2502 | d.cd(APPDIR); | 2502 | d.cd(APPDIR); |
2503 | QFileInfo fi(d, ".keymap"); | 2503 | QFileInfo fi(d, ".keymap"); |
2504 | FILE* f = fopen((const char *)fi.absFilePath(), "w"); | 2504 | FILE* f = fopen((const char *)fi.absFilePath(), "w"); |
2505 | #else /* USEQPE */ | 2505 | #else /* USEQPE */ |
2506 | FILE* f = fopen((const char *)Global::applicationFileName(APPDIR,".keymap"), "w"); | 2506 | FILE* f = fopen((const char *)Global::applicationFileName(APPDIR,".keymap"), "w"); |
2507 | #endif /* USEQPE */ | 2507 | #endif /* USEQPE */ |
2508 | if (f != NULL) | 2508 | if (f != NULL) |
2509 | { | 2509 | { |
2510 | uint cnt = KEYMAPVERSION; | 2510 | uint cnt = KEYMAPVERSION; |
2511 | fwrite(&cnt, sizeof(cnt), 1, f); | 2511 | fwrite(&cnt, sizeof(cnt), 1, f); |
2512 | cnt = kmap.count(); | 2512 | cnt = kmap.count(); |
2513 | fwrite(&cnt, sizeof(cnt), 1, f); | 2513 | fwrite(&cnt, sizeof(cnt), 1, f); |
2514 | for (QMap<orKey,int>::Iterator i = kmap.begin(); i != kmap.end(); i++) | 2514 | for (QMap<orKey,int>::Iterator i = kmap.begin(); i != kmap.end(); i++) |
2515 | { | 2515 | { |
2516 | orKey key = i.key(); | 2516 | orKey key = i.key(); |
2517 | int data = i.data(); | 2517 | int data = i.data(); |
2518 | fwrite(&key, sizeof(key), 1, f); | 2518 | fwrite(&key, sizeof(key), 1, f); |
2519 | fwrite(&data, sizeof(data), 1, f); | 2519 | fwrite(&data, sizeof(data), 1, f); |
2520 | qDebug("Saved %s as %u", (const char*)key.text(), data); | 2520 | qDebug("Saved %s as %u", (const char*)key.text(), data); |
2521 | } | 2521 | } |
2522 | fclose(f); | 2522 | fclose(f); |
2523 | } | 2523 | } |
2524 | } | 2524 | } |
2525 | showEditTools(); | 2525 | showEditTools(); |
2526 | } | 2526 | } |
2527 | 2527 | ||
2528 | /* | 2528 | /* |
2529 | void QTReaderApp::fileRevert() | 2529 | void QTReaderApp::fileRevert() |
2530 | { | 2530 | { |
2531 | clear(); | 2531 | clear(); |
2532 | fileOpen(); | 2532 | fileOpen(); |
2533 | } | 2533 | } |
2534 | 2534 | ||
2535 | void QTReaderApp::editCut() | 2535 | void QTReaderApp::editCut() |
2536 | { | 2536 | { |
2537 | #ifndef QT_NO_CLIPBOARD | 2537 | #ifndef QT_NO_CLIPBOARD |
2538 | editor->cut(); | 2538 | editor->cut(); |
2539 | #endif | 2539 | #endif |
2540 | } | 2540 | } |
2541 | */ | 2541 | */ |
2542 | void QTReaderApp::editMark() | 2542 | void QTReaderApp::editMark() |
2543 | { | 2543 | { |
2544 | m_savedpos = reader->pagelocate(); | 2544 | m_savedpos = reader->pagelocate(); |
2545 | } | 2545 | } |
2546 | 2546 | ||
2547 | void QTReaderApp::editCopy() | 2547 | void QTReaderApp::editCopy() |
2548 | { | 2548 | { |
2549 | QClipboard* cb = QApplication::clipboard(); | 2549 | QClipboard* cb = QApplication::clipboard(); |
2550 | QString text; | 2550 | QString text; |
2551 | int ch; | 2551 | int ch; |
2552 | unsigned long currentpos = reader->pagelocate(); | 2552 | unsigned long currentpos = reader->pagelocate(); |
2553 | unsigned long endpos = reader->locate(); | 2553 | unsigned long endpos = reader->locate(); |
2554 | if (m_savedpos == 0xffffffff) | 2554 | if (m_savedpos == 0xffffffff) |
2555 | { | 2555 | { |
2556 | m_savedpos = currentpos; | 2556 | m_savedpos = currentpos; |
2557 | } | 2557 | } |
2558 | reader->jumpto(m_savedpos); | 2558 | reader->jumpto(m_savedpos); |
2559 | while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF) | 2559 | while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF) |
2560 | { | 2560 | { |
2561 | text += ch; | 2561 | text += ch; |
2562 | } | 2562 | } |
2563 | cb->setText(text); | 2563 | cb->setText(text); |
2564 | reader->locate(currentpos); | 2564 | reader->locate(currentpos); |
2565 | m_savedpos = 0xffffffff; | 2565 | m_savedpos = 0xffffffff; |
2566 | } | 2566 | } |
2567 | 2567 | ||
2568 | void QTReaderApp::gotoStart() | 2568 | void QTReaderApp::gotoStart() |
2569 | { | 2569 | { |
2570 | reader->locate(reader->buffdoc.startSection()); | 2570 | reader->locate(reader->buffdoc.startSection()); |
2571 | } | 2571 | } |
2572 | 2572 | ||
2573 | void QTReaderApp::gotoEnd() | 2573 | void QTReaderApp::gotoEnd() |
2574 | { | 2574 | { |
2575 | reader->dopageup(reader->buffdoc.endSection()); | 2575 | reader->dopageup(reader->buffdoc.endSection()); |
2576 | } | 2576 | } |
2577 | 2577 | ||
2578 | void QTReaderApp::pageup() | 2578 | void QTReaderApp::pageup() |
2579 | { | 2579 | { |
2580 | reader->NavUp(); | 2580 | reader->NavUp(); |
2581 | } | 2581 | } |
2582 | 2582 | ||
2583 | void QTReaderApp::pagedn() | 2583 | void QTReaderApp::pagedn() |
2584 | { | 2584 | { |
2585 | reader->NavDown(); | 2585 | reader->NavDown(); |
2586 | } | 2586 | } |
2587 | 2587 | ||
2588 | void QTReaderApp::pagemode(bool _b) | 2588 | void QTReaderApp::pagemode(bool _b) |
2589 | { | 2589 | { |
2590 | reader->setpagemode(_b); | 2590 | reader->setpagemode(_b); |
2591 | } | 2591 | } |
2592 | 2592 | ||
2593 | /* | 2593 | /* |
2594 | void QTReaderApp::setspacing() | 2594 | void QTReaderApp::setspacing() |
2595 | { | 2595 | { |
2596 | m_nRegAction = cMonoSpace; | 2596 | m_nRegAction = cMonoSpace; |
2597 | char lcn[20]; | 2597 | char lcn[20]; |
2598 | sprintf(lcn, "%lu", reader->m_charpc); | 2598 | sprintf(lcn, "%lu", reader->m_charpc); |
2599 | regEdit->setText(lcn); | 2599 | regEdit->setText(lcn); |
2600 | do_regedit(); | 2600 | do_regedit(); |
2601 | } | 2601 | } |
2602 | */ | 2602 | */ |
2603 | void QTReaderApp::settarget() | 2603 | void QTReaderApp::settarget() |
2604 | { | 2604 | { |
2605 | m_nRegAction = cSetTarget; | 2605 | m_nRegAction = cSetTarget; |
2606 | QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp) | 2606 | QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp) |
2607 | + "/" | 2607 | + "/" |
2608 | + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg); | 2608 | + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg); |
2609 | regEdit->setText(text); | 2609 | regEdit->setText(text); |
2610 | do_regedit(); | 2610 | do_regedit(); |
2611 | } | 2611 | } |
2612 | 2612 | ||
2613 | /* | 2613 | /* |
2614 | void QTReaderApp::do_mono(const QString& lcn) | 2614 | void QTReaderApp::do_mono(const QString& lcn) |
2615 | { | 2615 | { |
2616 | bool ok; | 2616 | bool ok; |
2617 | unsigned long ulcn = lcn.toULong(&ok); | 2617 | unsigned long ulcn = lcn.toULong(&ok); |
2618 | if (ok) | 2618 | if (ok) |
2619 | { | 2619 | { |
2620 | reader->m_charpc = ulcn; | 2620 | reader->m_charpc = ulcn; |
2621 | reader->setfont(); | 2621 | reader->setfont(); |
2622 | reader->refresh(); | 2622 | reader->refresh(); |
2623 | //reader->setmono(true); | 2623 | //reader->setmono(true); |
2624 | } | 2624 | } |
2625 | else | 2625 | else |
2626 | QMessageBox::information(this, PROGNAME, "Must be a number"); | 2626 | QMessageBox::information(this, PROGNAME, "Must be a number"); |
2627 | } | 2627 | } |
2628 | */ | 2628 | */ |
2629 | /* | 2629 | /* |
2630 | void QTReaderApp::editPaste() | 2630 | void QTReaderApp::editPaste() |
2631 | { | 2631 | { |
2632 | #ifndef QT_NO_CLIPBOARD | 2632 | #ifndef QT_NO_CLIPBOARD |
2633 | editor->paste(); | 2633 | editor->paste(); |
2634 | #endif | 2634 | #endif |
2635 | } | 2635 | } |
2636 | */ | 2636 | */ |
2637 | 2637 | ||
2638 | void QTReaderApp::editFind() | 2638 | void QTReaderApp::editFind() |
2639 | { | 2639 | { |
2640 | searchStart = reader->pagelocate(); | 2640 | searchStart = reader->pagelocate(); |
2641 | #ifdef __ISEARCH | 2641 | #ifdef __ISEARCH |
2642 | searchStack = new QStack<searchrecord>; | 2642 | searchStack = new QStack<searchrecord>; |
2643 | #endif | 2643 | #endif |
2644 | #ifdef USEQPE | 2644 | #ifdef USEQPE |
2645 | Global::showInputMethod(); | 2645 | Global::showInputMethod(); |
2646 | #endif | 2646 | #endif |
2647 | searchBar->show(); | 2647 | searchBar->show(); |
2648 | searchVisible = TRUE; | 2648 | searchVisible = TRUE; |
2649 | searchEdit->setFocus(); | 2649 | searchEdit->setFocus(); |
2650 | #ifdef __ISEARCH | 2650 | #ifdef __ISEARCH |
2651 | searchStack->push(new searchrecord("",reader->pagelocate())); | 2651 | searchStack->push(new searchrecord("",reader->pagelocate())); |
2652 | #endif | 2652 | #endif |
2653 | } | 2653 | } |
2654 | 2654 | ||
2655 | void QTReaderApp::findNext() | 2655 | void QTReaderApp::findNext() |
2656 | { | 2656 | { |
2657 | // // qDebug("findNext called\n"); | 2657 | // // qDebug("findNext called\n"); |
2658 | #ifdef __ISEARCH | 2658 | #ifdef __ISEARCH |
2659 | QString arg = searchEdit->text(); | 2659 | QString arg = searchEdit->text(); |
2660 | #else | 2660 | #else |
2661 | QRegExp arg = searchEdit->text(); | 2661 | QRegExp arg = searchEdit->text(); |
2662 | #endif | 2662 | #endif |
2663 | CDrawBuffer test(&(reader->m_fontControl)); | 2663 | CDrawBuffer test(&(reader->m_fontControl)); |
2664 | size_t start = reader->pagelocate(); | 2664 | size_t start = reader->pagelocate(); |
2665 | reader->jumpto(start); | 2665 | reader->jumpto(start); |
2666 | reader->getline(&test); | 2666 | reader->getline(&test); |
2667 | dosearch(start, test, arg); | 2667 | dosearch(start, test, arg); |
2668 | } | 2668 | } |
2669 | 2669 | ||
2670 | void QTReaderApp::findClose() | 2670 | void QTReaderApp::findClose() |
2671 | { | 2671 | { |
2672 | searchVisible = FALSE; | 2672 | searchVisible = FALSE; |
2673 | searchEdit->setText(""); | 2673 | searchEdit->setText(""); |
2674 | #ifdef USEQPE | 2674 | #ifdef USEQPE |
2675 | Global::hideInputMethod(); | 2675 | Global::hideInputMethod(); |
2676 | #endif | 2676 | #endif |
2677 | searchBar->hide(); | 2677 | searchBar->hide(); |
2678 | #ifdef __ISEARCH | 2678 | #ifdef __ISEARCH |
2679 | // searchStack = new QStack<searchrecord>; | 2679 | // searchStack = new QStack<searchrecord>; |
2680 | while (!searchStack->isEmpty()) | 2680 | while (!searchStack->isEmpty()) |
2681 | { | 2681 | { |
2682 | delete searchStack->pop(); | 2682 | delete searchStack->pop(); |
2683 | } | 2683 | } |
2684 | delete searchStack; | 2684 | delete searchStack; |
2685 | #endif | 2685 | #endif |
2686 | reader->setFocus(); | 2686 | reader->setFocus(); |
2687 | } | 2687 | } |
2688 | 2688 | ||
2689 | void QTReaderApp::regClose() | 2689 | void QTReaderApp::regClose() |
2690 | { | 2690 | { |
2691 | regVisible = FALSE; | 2691 | regVisible = FALSE; |
2692 | regEdit->setText(""); | 2692 | regEdit->setText(""); |
2693 | regBar->hide(); | 2693 | regBar->hide(); |
2694 | #ifdef USEQPE | 2694 | #ifdef USEQPE |
2695 | Global::hideInputMethod(); | 2695 | Global::hideInputMethod(); |
2696 | #endif | 2696 | #endif |
2697 | reader->setFocus(); | 2697 | reader->setFocus(); |
2698 | } | 2698 | } |
2699 | 2699 | ||
2700 | #ifdef __ISEARCH | 2700 | #ifdef __ISEARCH |
2701 | bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QString& arg) | 2701 | bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QString& arg) |
2702 | #else | 2702 | #else |
2703 | bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg) | 2703 | bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg) |
2704 | #endif | 2704 | #endif |
2705 | { | 2705 | { |
2706 | bool ret = true; | 2706 | bool ret = true; |
2707 | unsigned long fs, ts; | 2707 | unsigned long fs, ts; |
2708 | reader->sizes(fs,ts); | 2708 | reader->sizes(fs,ts); |
2709 | size_t pos = reader->locate(); | 2709 | size_t pos = reader->locate(); |
2710 | pbar->setGeometry(searchBar->x(),searchBar->y(),searchBar->width(), searchBar->height()); | 2710 | pbar->setGeometry(searchBar->x(),searchBar->y(),searchBar->width(), searchBar->height()); |
2711 | pbar->show(); | 2711 | pbar->show(); |
2712 | pbar->raise(); | 2712 | pbar->raise(); |
2713 | pbar->reset(); | 2713 | pbar->reset(); |
2714 | int offset; | 2714 | int offset; |
2715 | int lastpc = (100*pos)/ts; | 2715 | int lastpc = (100*pos)/ts; |
2716 | pbar->setProgress(lastpc); | 2716 | pbar->setProgress(lastpc); |
2717 | // qApp->processEvents(); | 2717 | // qApp->processEvents(); |
2718 | if (reader->buffdoc.getpara(test) >= 0) | 2718 | if (reader->buffdoc.getpara(test) >= 0) |
2719 | { | 2719 | { |
2720 | reader->setFocus(); | 2720 | reader->setFocus(); |
2721 | #ifdef __ISEARCH | 2721 | #ifdef __ISEARCH |
2722 | while (strstr(test.data(),(const tchar*)arg) == NULL) | 2722 | while (strstr(test.data(),(const tchar*)arg) == NULL) |
2723 | #else | 2723 | #else |
2724 | #ifdef _UNICODE | 2724 | #ifdef _UNICODE |
2725 | while ((offset = arg.match(toQString(test.data()))) == -1) | 2725 | while ((offset = arg.match(toQString(test.data()))) == -1) |
2726 | #else | 2726 | #else |
2727 | while (arg.match(test.data()) == -1) | 2727 | while (arg.match(test.data()) == -1) |
2728 | #endif | 2728 | #endif |
2729 | #endif | 2729 | #endif |
2730 | { | 2730 | { |
2731 | pos = reader->locate(); | 2731 | pos = reader->locate(); |
2732 | int pc = (100*pos)/ts; | 2732 | int pc = (100*pos)/ts; |
2733 | if (pc != lastpc) | 2733 | if (pc != lastpc) |
2734 | { | 2734 | { |
2735 | pbar->setProgress(pc); | 2735 | pbar->setProgress(pc); |
2736 | qApp->processEvents(); | 2736 | qApp->processEvents(); |
2737 | reader->setFocus(); | 2737 | reader->setFocus(); |
2738 | lastpc = pc; | 2738 | lastpc = pc; |
2739 | } | 2739 | } |
2740 | 2740 | ||
2741 | if (reader->buffdoc.getpara(test) < 0) | 2741 | if (reader->buffdoc.getpara(test) < 0) |
2742 | { | 2742 | { |
2743 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) | 2743 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) |
2744 | pos = searchStart; | 2744 | pos = searchStart; |
2745 | else | 2745 | else |
2746 | pos = start; | 2746 | pos = start; |
2747 | findClose(); | 2747 | findClose(); |
2748 | pbar->hide(); | 2748 | pbar->hide(); |
2749 | reader->locate(pos); | 2749 | reader->locate(pos); |
2750 | return false; | 2750 | return false; |
2751 | } | 2751 | } |
2752 | } | 2752 | } |
2753 | // qDebug("Found it at %u:%u", pos, offset); | 2753 | // qDebug("Found it at %u:%u", pos, offset); |
2754 | pbar->hide(); | 2754 | pbar->hide(); |
2755 | // qDebug("Hid"); | 2755 | // qDebug("Hid"); |
2756 | reader->locate(pos+offset); | 2756 | reader->locate(pos+offset); |
2757 | // qDebug("Loacted"); | 2757 | // qDebug("Loacted"); |
2758 | // qDebug("page up"); | 2758 | // qDebug("page up"); |
2759 | ret = true; | 2759 | ret = true; |
2760 | } | 2760 | } |
2761 | else | 2761 | else |
2762 | { | 2762 | { |
2763 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) | 2763 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) |
2764 | pos = searchStart; | 2764 | pos = searchStart; |
2765 | else | 2765 | else |
2766 | pos = start; | 2766 | pos = start; |
2767 | ret = false; | 2767 | ret = false; |
2768 | findClose(); | 2768 | findClose(); |
2769 | } | 2769 | } |
2770 | return ret; | 2770 | return ret; |
2771 | } | 2771 | } |
2772 | 2772 | ||
2773 | #ifdef __ISEARCH | 2773 | #ifdef __ISEARCH |
2774 | void QTReaderApp::search(const QString & arg) | 2774 | void QTReaderApp::search(const QString & arg) |
2775 | { | 2775 | { |
2776 | searchrecord* ss = searchStack->top(); | 2776 | searchrecord* ss = searchStack->top(); |
2777 | CBuffer test; | 2777 | CBuffer test; |
2778 | size_t start = reader->pagelocate(); | 2778 | size_t start = reader->pagelocate(); |
2779 | bool haspopped = false; | 2779 | bool haspopped = false; |
2780 | while (arg.left(ss->s.length()) != ss->s) | 2780 | while (arg.left(ss->s.length()) != ss->s) |
2781 | { | 2781 | { |
2782 | haspopped = true; | 2782 | haspopped = true; |
2783 | start = ss->pos; | 2783 | start = ss->pos; |
2784 | // reader->locate(start); | 2784 | // reader->locate(start); |
2785 | searchStack->pop(); | 2785 | searchStack->pop(); |
2786 | delete ss; | 2786 | delete ss; |
2787 | } | 2787 | } |
2788 | if (haspopped) reader->locate(start); | 2788 | if (haspopped) reader->locate(start); |
2789 | /* | 2789 | /* |
2790 | if (arg.length() < ss->len) | 2790 | if (arg.length() < ss->len) |
2791 | { | 2791 | { |
2792 | start = ss->pos; | 2792 | start = ss->pos; |
2793 | reader->locate(start); | 2793 | reader->locate(start); |
2794 | searchStack->pop(); | 2794 | searchStack->pop(); |
2795 | delete ss; | 2795 | delete ss; |
2796 | } | 2796 | } |
2797 | */ | 2797 | */ |
2798 | else | 2798 | else |
2799 | { | 2799 | { |
2800 | start = reader->pagelocate(); | 2800 | start = reader->pagelocate(); |
2801 | reader->jumpto(start); | 2801 | reader->jumpto(start); |
2802 | searchStack->push(new searchrecord(arg,start)); | 2802 | searchStack->push(new searchrecord(arg,start)); |
2803 | } | 2803 | } |
2804 | dosearch(start, test, arg); | 2804 | dosearch(start, test, arg); |
2805 | } | 2805 | } |
2806 | #else | 2806 | #else |
2807 | void QTReaderApp::search() | 2807 | void QTReaderApp::search() |
2808 | { | 2808 | { |
2809 | findNext(); | 2809 | findNext(); |
2810 | } | 2810 | } |
2811 | #endif | 2811 | #endif |
2812 | 2812 | ||
2813 | void QTReaderApp::openFile( const QString &f, unsigned int loc ) | 2813 | void QTReaderApp::openFile( const QString &f, unsigned int loc ) |
2814 | { | 2814 | { |
2815 | // qDebug("File:%s", (const char*)f); | 2815 | // qDebug("File:%s", (const char*)f); |
2816 | // openFile(DocLnk(f)); | 2816 | // openFile(DocLnk(f)); |
2817 | //} | 2817 | //} |
2818 | // | 2818 | // |
2819 | //void QTReaderApp::openFile( const DocLnk &f ) | 2819 | //void QTReaderApp::openFile( const DocLnk &f ) |
2820 | //{ | 2820 | //{ |
2821 | clear(); | 2821 | clear(); |
2822 | QFileInfo fm(f); | 2822 | QFileInfo fm(f); |
2823 | if ( fm.exists() ) | 2823 | if ( fm.exists() ) |
2824 | { | 2824 | { |
2825 | // QMessageBox::information(0, "Progress", "Calling fileNew()"); | 2825 | // QMessageBox::information(0, "Progress", "Calling fileNew()"); |
2826 | #ifdef USEQPE | 2826 | #ifdef USEQPE |
2827 | if (fm.extension( FALSE ) == "desktop") | 2827 | if (fm.extension( FALSE ) == "desktop") |
2828 | { | 2828 | { |
2829 | DocLnk d(f); | 2829 | DocLnk d(f); |
2830 | QFileInfo fnew(d.file()); | 2830 | QFileInfo fnew(d.file()); |
2831 | fm = fnew; | 2831 | fm = fnew; |
2832 | if (!fm.exists()) return; | 2832 | if (!fm.exists()) return; |
2833 | } | 2833 | } |
2834 | #endif | 2834 | #endif |
2835 | clear(); | 2835 | clear(); |
2836 | reader->setText(fm.baseName(), fm.absFilePath(), loc); | 2836 | reader->setText(fm.baseName(), fm.absFilePath(), loc); |
2837 | m_loadedconfig = readconfig(APPDIR "/configs", reader->m_string, false); | 2837 | m_loadedconfig = readconfig(APPDIR "/configs", reader->m_string, false); |
2838 | qDebug("Showing tools"); | 2838 | qDebug("Showing tools"); |
2839 | showEditTools(); | 2839 | showEditTools(); |
2840 | qDebug("Shown tools"); | 2840 | qDebug("Shown tools"); |
2841 | readbkmks(); | 2841 | readbkmks(); |
2842 | qDebug("read markss"); | 2842 | qDebug("read markss"); |
2843 | m_savedpos = 0xffffffff; | 2843 | m_savedpos = 0xffffffff; |
2844 | } | 2844 | } |
2845 | else | 2845 | else |
2846 | { | 2846 | { |
2847 | QString msg = f; | 2847 | QString msg = f; |
2848 | msg += "\nFile does not exist"; | 2848 | msg += "\nFile does not exist"; |
2849 | QMessageBox::information(this, PROGNAME, msg); | 2849 | QMessageBox::information(this, PROGNAME, msg); |
2850 | reader->m_lastfile = QString::null; | 2850 | reader->m_lastfile = QString::null; |
2851 | } | 2851 | } |
2852 | 2852 | ||
2853 | } | 2853 | } |
2854 | /* | 2854 | /* |
2855 | void QTReaderApp::resizeEvent(QResizeEvent* e) | 2855 | void QTReaderApp::resizeEvent(QResizeEvent* e) |
2856 | { | 2856 | { |
2857 | if (m_fullscreen) | 2857 | if (m_fullscreen) |
2858 | { | 2858 | { |
2859 | showNormal(); | 2859 | showNormal(); |
2860 | showFullScreen(); | 2860 | showFullScreen(); |
2861 | } | 2861 | } |
2862 | } | 2862 | } |
2863 | */ | 2863 | */ |
2864 | void QTReaderApp::handlekey(QKeyEvent* e) | 2864 | void QTReaderApp::handlekey(QKeyEvent* e) |
2865 | { | 2865 | { |
2866 | // qDebug("Keypress event"); | 2866 | // qDebug("Keypress event"); |
2867 | timeb now; | 2867 | timeb now; |
2868 | ftime(&now); | 2868 | ftime(&now); |
2869 | unsigned long etime = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm; | 2869 | unsigned long etime = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm; |
2870 | if (etime < m_debounce) | 2870 | if (etime < m_debounce) |
2871 | { | 2871 | { |
2872 | return; | 2872 | return; |
2873 | } | 2873 | } |
2874 | switch(e->key()) | 2874 | switch(e->key()) |
2875 | { | 2875 | { |
2876 | case Key_Escape: | 2876 | case Key_Escape: |
2877 | qDebug("escape event"); | 2877 | qDebug("escape event"); |
2878 | if (m_disableesckey) | 2878 | if (m_disableesckey) |
2879 | { | 2879 | { |
2880 | m_disableesckey = false; | 2880 | m_disableesckey = false; |
2881 | } | 2881 | } |
2882 | else | 2882 | else |
2883 | { | 2883 | { |
2884 | m_bcloseDisabled = true; | 2884 | m_bcloseDisabled = true; |
2885 | if (m_fullscreen) | 2885 | if (m_fullscreen) |
2886 | { | 2886 | { |
2887 | m_actFullscreen->setOn(false); | 2887 | m_actFullscreen->setOn(false); |
2888 | e->accept(); | 2888 | e->accept(); |
2889 | } | 2889 | } |
2890 | else | 2890 | else |
2891 | { | 2891 | { |
2892 | // qDebug("escape action"); | 2892 | // qDebug("escape action"); |
2893 | doAction(e); | 2893 | doAction(e); |
2894 | } | 2894 | } |
2895 | } | 2895 | } |
2896 | break; | 2896 | break; |
2897 | /* | 2897 | /* |
2898 | case Key_Left: | 2898 | case Key_Left: |
2899 | { | 2899 | { |
2900 | if (reader->m_autoScroll) | 2900 | if (reader->m_autoScroll) |
2901 | { | 2901 | { |
2902 | reader->reduceScroll(); | 2902 | reader->reduceScroll(); |
2903 | } | 2903 | } |
2904 | else | 2904 | else |
2905 | { | 2905 | { |
2906 | doAction(e); | 2906 | doAction(e); |
2907 | } | 2907 | } |
2908 | } | 2908 | } |
2909 | break; | 2909 | break; |
2910 | case Key_Right: | 2910 | case Key_Right: |
2911 | { | 2911 | { |
2912 | if (reader->m_autoScroll) | 2912 | if (reader->m_autoScroll) |
2913 | { | 2913 | { |
2914 | reader->increaseScroll(); | 2914 | reader->increaseScroll(); |
2915 | } | 2915 | } |
2916 | else | 2916 | else |
2917 | { | 2917 | { |
2918 | doAction(e); | 2918 | doAction(e); |
2919 | } | 2919 | } |
2920 | } | 2920 | } |
2921 | break; | 2921 | break; |
2922 | case Key_Up: | 2922 | case Key_Up: |
2923 | { | 2923 | { |
2924 | if (reader->m_autoScroll) | 2924 | if (reader->m_autoScroll) |
2925 | { | 2925 | { |
2926 | reader->increaseScroll(); | 2926 | reader->increaseScroll(); |
2927 | } | 2927 | } |
2928 | else | 2928 | else |
2929 | { | 2929 | { |
2930 | doAction(e); | 2930 | doAction(e); |
2931 | } | 2931 | } |
2932 | } | 2932 | } |
2933 | break; | 2933 | break; |
2934 | case Key_Down: | 2934 | case Key_Down: |
2935 | { | 2935 | { |
2936 | if (reader->m_autoScroll) | 2936 | if (reader->m_autoScroll) |
2937 | { | 2937 | { |
2938 | reader->reduceScroll(); | 2938 | reader->reduceScroll(); |
2939 | } | 2939 | } |
2940 | else | 2940 | else |
2941 | { | 2941 | { |
2942 | doAction(e); | 2942 | doAction(e); |
2943 | } | 2943 | } |
2944 | } | 2944 | } |
2945 | break; | 2945 | break; |
2946 | */ | 2946 | */ |
2947 | default: | 2947 | default: |
2948 | { | 2948 | { |
2949 | doAction(e); | 2949 | doAction(e); |
2950 | } | 2950 | } |
2951 | 2951 | ||
2952 | /* | 2952 | /* |
2953 | QString msg("Key press was:"); | 2953 | QString msg("Key press was:"); |
2954 | QString key; | 2954 | QString key; |
2955 | msg += key.setNum(e->key()); | 2955 | msg += key.setNum(e->key()); |
2956 | QMessageBox::information(this, PROGNAME, msg); | 2956 | QMessageBox::information(this, PROGNAME, msg); |
2957 | */ | 2957 | */ |
2958 | } | 2958 | } |
2959 | ftime(&m_lastkeytime); | 2959 | ftime(&m_lastkeytime); |
2960 | } | 2960 | } |
2961 | 2961 | ||
2962 | #if defined(USEQPE) && defined(USENEWFULLSCREEN) | 2962 | #if defined(USEQPE) && defined(USENEWFULLSCREEN) |
2963 | void QTReaderApp::focusInEvent(QFocusEvent *) | 2963 | void QTReaderApp::focusInEvent(QFocusEvent *) |
2964 | { | 2964 | { |
2965 | if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader)) | 2965 | if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader)) |
2966 | { | 2966 | { |
2967 | m_usenewfullscreen = false; | 2967 | m_usenewfullscreen = false; |
2968 | reader->bDoUpdates = false; | 2968 | reader->bDoUpdates = false; |
2969 | showEditTools(); | 2969 | showEditTools(); |
2970 | reader->bDoUpdates = true; | 2970 | reader->bDoUpdates = true; |
2971 | reader->update(); | 2971 | reader->update(); |
2972 | m_usenewfullscreen = true; | 2972 | m_usenewfullscreen = true; |
2973 | } | 2973 | } |
2974 | } | 2974 | } |
2975 | 2975 | ||
2976 | void QTReaderApp::resizeEvent(QResizeEvent *) | 2976 | void QTReaderApp::resizeEvent(QResizeEvent *) |
2977 | { | 2977 | { |
2978 | if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader)) | 2978 | if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader)) |
2979 | { | 2979 | { |
2980 | m_usenewfullscreen = false; | 2980 | m_usenewfullscreen = false; |
2981 | reader->bDoUpdates = false; | 2981 | reader->bDoUpdates = false; |
2982 | showEditTools(); | 2982 | showEditTools(); |
2983 | reader->bDoUpdates = true; | 2983 | reader->bDoUpdates = true; |
2984 | reader->update(); | 2984 | reader->update(); |
2985 | m_usenewfullscreen = true; | 2985 | m_usenewfullscreen = true; |
2986 | } | 2986 | } |
2987 | } | 2987 | } |
2988 | #endif | 2988 | #endif |
2989 | 2989 | ||
2990 | void QTReaderApp::showEditTools() | 2990 | void QTReaderApp::showEditTools() |
2991 | { | 2991 | { |
2992 | // if ( !doc ) | 2992 | // if ( !doc ) |
2993 | //close(); | 2993 | //close(); |
2994 | if (m_fullscreen) | 2994 | if (m_fullscreen) |
2995 | { | 2995 | { |
2996 | #if defined(USEQPE) | 2996 | #if defined(USEQPE) |
2997 | if (menubar != NULL) menubar->hide(); | 2997 | if (menubar != NULL) menubar->hide(); |
2998 | #endif | 2998 | #endif |
2999 | if (fileBar != NULL) fileBar->hide(); | 2999 | if (fileBar != NULL) fileBar->hide(); |
3000 | if (viewBar != NULL) viewBar->hide(); | 3000 | if (viewBar != NULL) viewBar->hide(); |
3001 | if (navBar != NULL) navBar->hide(); | 3001 | if (navBar != NULL) navBar->hide(); |
3002 | if (markBar != NULL) markBar->hide(); | 3002 | if (markBar != NULL) markBar->hide(); |
3003 | if (m_prog != NULL) | 3003 | if (m_prog != NULL) |
3004 | { | 3004 | { |
3005 | // qDebug("Hiding status"); | 3005 | // qDebug("Hiding status"); |
3006 | m_prog->hide(); | 3006 | m_prog->hide(); |
3007 | } | 3007 | } |
3008 | searchBar->hide(); | 3008 | searchBar->hide(); |
3009 | regBar->hide(); | 3009 | regBar->hide(); |
3010 | #ifdef USEQPE | 3010 | #ifdef USEQPE |
3011 | Global::hideInputMethod(); | 3011 | Global::hideInputMethod(); |
3012 | #endif | 3012 | #endif |
3013 | if (m_scrollbar != NULL) m_scrollbar->hide(); | 3013 | if (m_scrollbar != NULL) m_scrollbar->hide(); |
3014 | m_fontBar->hide(); | 3014 | m_fontBar->hide(); |
3015 | //showNormal(); | 3015 | //showNormal(); |
3016 | showFullScreen(); | 3016 | showFullScreen(); |
3017 | } | 3017 | } |
3018 | else | 3018 | else |
3019 | { | 3019 | { |
3020 | //qDebug("him"); | 3020 | //qDebug("him"); |
3021 | #ifdef USEQPE | 3021 | #ifdef USEQPE |
3022 | Global::hideInputMethod(); | 3022 | Global::hideInputMethod(); |
3023 | #endif | 3023 | #endif |
3024 | //qDebug("eb"); | 3024 | //qDebug("eb"); |
3025 | if (m_scrollbar != NULL) | 3025 | if (m_scrollbar != NULL) |
3026 | { | 3026 | { |
3027 | if (m_scrollishidden) | 3027 | if (m_scrollishidden) |
3028 | { | 3028 | { |
3029 | m_scrollbar->hide(); | 3029 | m_scrollbar->hide(); |
3030 | } | 3030 | } |
3031 | else | 3031 | else |
3032 | { | 3032 | { |
3033 | m_scrollbar->show(); | 3033 | m_scrollbar->show(); |
3034 | } | 3034 | } |
3035 | } | 3035 | } |
3036 | if (!m_hidebars) | 3036 | if (!m_hidebars) |
3037 | { | 3037 | { |
3038 | #if defined(USEQPE) | 3038 | #if defined(USEQPE) |
3039 | menubar->show(); | 3039 | menubar->show(); |
3040 | #endif | 3040 | #endif |
3041 | if (fileBar != NULL) fileBar->show(); | 3041 | if (fileBar != NULL) fileBar->show(); |
3042 | if (viewBar != NULL) viewBar->show(); | 3042 | if (viewBar != NULL) viewBar->show(); |
3043 | if (navBar != NULL) navBar->show(); | 3043 | if (navBar != NULL) navBar->show(); |
3044 | if (markBar != NULL) markBar->show(); | 3044 | if (markBar != NULL) markBar->show(); |
3045 | if (m_prog != NULL && !m_statusishidden) | 3045 | if (m_prog != NULL && !m_statusishidden) |
3046 | { | 3046 | { |
3047 | // qDebug("Showing status"); | 3047 | // qDebug("Showing status"); |
3048 | m_prog->show(); | 3048 | m_prog->show(); |
3049 | // qDebug("Shown status"); | 3049 | // qDebug("Shown status"); |
3050 | } | 3050 | } |
3051 | // qDebug("Showing mb"); | 3051 | // qDebug("Showing mb"); |
3052 | mb->show(); | 3052 | mb->show(); |
3053 | } | 3053 | } |
3054 | if ( searchVisible ) | 3054 | if ( searchVisible ) |
3055 | { | 3055 | { |
3056 | #ifdef USEQPE | 3056 | #ifdef USEQPE |
3057 | Global::showInputMethod(); | 3057 | Global::showInputMethod(); |
3058 | #endif | 3058 | #endif |
3059 | searchBar->show(); | 3059 | searchBar->show(); |
3060 | } | 3060 | } |
3061 | if ( regVisible ) | 3061 | if ( regVisible ) |
3062 | { | 3062 | { |
3063 | #ifdef USEQPE | 3063 | #ifdef USEQPE |
3064 | Global::showInputMethod(); | 3064 | Global::showInputMethod(); |
3065 | #endif | 3065 | #endif |
3066 | regBar->show(); | 3066 | regBar->show(); |
3067 | } | 3067 | } |
3068 | if (m_fontVisible) m_fontBar->show(); | 3068 | if (m_fontVisible) m_fontBar->show(); |
3069 | //qDebug("sn"); | 3069 | //qDebug("sn"); |
3070 | showNormal(); | 3070 | showNormal(); |
3071 | //qDebug("sm"); | 3071 | //qDebug("sm"); |
3072 | #if defined(USEQPE) && !defined(SIMPAD) | 3072 | #if defined(USEQPE) && !defined(SIMPAD) |
3073 | showMaximized(); | 3073 | showMaximized(); |
3074 | #endif | 3074 | #endif |
3075 | //setCentralWidget(reader); | 3075 | //setCentralWidget(reader); |
3076 | } | 3076 | } |
3077 | 3077 | ||
3078 | // qDebug("uc"); | 3078 | // qDebug("uc"); |
3079 | updateCaption(); | 3079 | updateCaption(); |
3080 | // qDebug("rw"); | 3080 | // qDebug("rw"); |
3081 | editorStack->raiseWidget( reader ); | 3081 | editorStack->raiseWidget( reader ); |
3082 | // qDebug("sf"); | 3082 | // qDebug("sf"); |
3083 | reader->setFocus(); | 3083 | reader->setFocus(); |
3084 | // qDebug("ref"); | 3084 | // qDebug("ref"); |
3085 | //reader->refresh(true); | 3085 | //reader->refresh(true); |
3086 | // qDebug("done"); | 3086 | // qDebug("done"); |
3087 | } | 3087 | } |
3088 | /* | 3088 | /* |
3089 | void QTReaderApp::save() | 3089 | void QTReaderApp::save() |
3090 | { | 3090 | { |
3091 | if ( !doc ) | 3091 | if ( !doc ) |
3092 | return; | 3092 | return; |
3093 | if ( !editor->edited() ) | 3093 | if ( !editor->edited() ) |
3094 | return; | 3094 | return; |
3095 | 3095 | ||
3096 | QString rt = editor->text(); | 3096 | QString rt = editor->text(); |
3097 | QString pt = rt; | 3097 | QString pt = rt; |
3098 | 3098 | ||
3099 | if ( doc->name().isEmpty() ) { | 3099 | if ( doc->name().isEmpty() ) { |
3100 | unsigned ispace = pt.find( ' ' ); | 3100 | unsigned ispace = pt.find( ' ' ); |
3101 | unsigned ienter = pt.find( '\n' ); | 3101 | unsigned ienter = pt.find( '\n' ); |
3102 | int i = (ispace < ienter) ? ispace : ienter; | 3102 | int i = (ispace < ienter) ? ispace : ienter; |
3103 | QString docname; | 3103 | QString docname; |
3104 | if ( i == -1 ) { | 3104 | if ( i == -1 ) { |
3105 | if ( pt.isEmpty() ) | 3105 | if ( pt.isEmpty() ) |
3106 | docname = "Empty Text"; | 3106 | docname = "Empty Text"; |
3107 | else | 3107 | else |
3108 | docname = pt; | 3108 | docname = pt; |
3109 | } else { | 3109 | } else { |
3110 | docname = pt.left( i ); | 3110 | docname = pt.left( i ); |
3111 | } | 3111 | } |
3112 | doc->setName(docname); | 3112 | doc->setName(docname); |
3113 | } | 3113 | } |
3114 | FileManager fm; | 3114 | FileManager fm; |
3115 | fm.saveFile( *doc, rt ); | 3115 | fm.saveFile( *doc, rt ); |
3116 | } | 3116 | } |
3117 | */ | 3117 | */ |
3118 | 3118 | ||
3119 | void QTReaderApp::clear() | 3119 | void QTReaderApp::clear() |
3120 | { | 3120 | { |
3121 | // if (doc != 0) | 3121 | // if (doc != 0) |
3122 | // { | 3122 | // { |
3123 | // QMessageBox::information(this, PROGNAME, "Deleting doc", 1); | 3123 | // QMessageBox::information(this, PROGNAME, "Deleting doc", 1); |
3124 | //delete doc; | 3124 | //delete doc; |
3125 | // QMessageBox::information(this, PROGNAME, "Deleted doc", 1); | 3125 | // QMessageBox::information(this, PROGNAME, "Deleted doc", 1); |
3126 | //doc = 0; | 3126 | //doc = 0; |
3127 | // } | 3127 | // } |
3128 | reader->clear(); | 3128 | reader->clear(); |
3129 | } | 3129 | } |
3130 | 3130 | ||
3131 | void QTReaderApp::updateCaption() | 3131 | void QTReaderApp::updateCaption() |
3132 | { | 3132 | { |
3133 | // if ( !doc ) | 3133 | // if ( !doc ) |
3134 | //setCaption( tr("QTReader") ); | 3134 | //setCaption( tr("QTReader") ); |
3135 | // else { | 3135 | // else { |
3136 | //QString s = doc->name(); | 3136 | //QString s = doc->name(); |
3137 | //if ( s.isEmpty() ) | 3137 | //if ( s.isEmpty() ) |
3138 | // s = tr( "Unnamed" ); | 3138 | // s = tr( "Unnamed" ); |
3139 | setCaption( reader->m_string + " - " + tr(SHORTPROGNAME) ); | 3139 | setCaption( reader->m_string + " - " + tr(SHORTPROGNAME) ); |
3140 | // } | 3140 | // } |
3141 | } | 3141 | } |
3142 | 3142 | ||
3143 | void QTReaderApp::setDocument(const QString& fileref) | 3143 | void QTReaderApp::setDocument(const QString& fileref) |
3144 | { | 3144 | { |
3145 | //QMessageBox::information(0, "setDocument", fileref); | 3145 | //QMessageBox::information(0, "setDocument", fileref); |
3146 | openFile(fileref); | 3146 | openFile(fileref); |
3147 | // showEditTools(); | 3147 | // showEditTools(); |
3148 | } | 3148 | } |
3149 | 3149 | ||
3150 | void QTReaderApp::closeEvent( QCloseEvent *e ) | 3150 | void QTReaderApp::closeEvent( QCloseEvent *e ) |
3151 | { | 3151 | { |
3152 | // qDebug("Close event"); | 3152 | // qDebug("Close event"); |
3153 | if (m_fullscreen) | 3153 | if (m_fullscreen) |
3154 | { | 3154 | { |
3155 | m_fullscreen = false; | 3155 | m_fullscreen = false; |
3156 | showEditTools(); | 3156 | showEditTools(); |
3157 | e->ignore(); | 3157 | e->ignore(); |
3158 | } | 3158 | } |
3159 | else if (editorStack->visibleWidget() == m_buttonprefs) | 3159 | else if (editorStack->visibleWidget() == m_buttonprefs) |
3160 | { | 3160 | { |
3161 | m_buttonprefs->mapkey(Qt::NoButton, Key_Escape); | 3161 | int ret = QMessageBox::warning(this, PROGNAME, |
3162 | tr("Do you wish to map this key?\n\nIf you proceed you will map\nthe escape key and you will\nneed to press the close box\ntwice to exit this program\n\nContinue?"), tr("Yes"), tr("No"), QString::null, 0, 1); | ||
3163 | if (ret == 0) | ||
3164 | { | ||
3165 | m_buttonprefs->mapkey(Qt::NoButton, Key_Escape); | ||
3166 | } | ||
3162 | e->ignore(); | 3167 | e->ignore(); |
3163 | } | 3168 | } |
3164 | else if (m_dontSave) | 3169 | else if (m_dontSave) |
3165 | { | 3170 | { |
3166 | e->accept(); | 3171 | e->accept(); |
3167 | } | 3172 | } |
3168 | else | 3173 | else |
3169 | { | 3174 | { |
3170 | if (editorStack->visibleWidget() == reader) | 3175 | if (editorStack->visibleWidget() == reader) |
3171 | { | 3176 | { |
3172 | if ((kmap.find(orKey(Qt::NoButton,Key_Escape,false)) != kmap.end()) && m_bcloseDisabled) | 3177 | if ((kmap.find(orKey(Qt::NoButton,Key_Escape,false)) != kmap.end()) && m_bcloseDisabled) |
3173 | { | 3178 | { |
3174 | //qDebug("Close disabled"); | 3179 | //qDebug("Close disabled"); |
3175 | m_bcloseDisabled = false; | 3180 | m_bcloseDisabled = false; |
3176 | e->ignore(); | 3181 | e->ignore(); |
3177 | } | 3182 | } |
3178 | else | 3183 | else |
3179 | { | 3184 | { |
3180 | if (m_fontVisible) | 3185 | if (m_fontVisible) |
3181 | { | 3186 | { |
3182 | m_fontBar->hide(); | 3187 | m_fontBar->hide(); |
3183 | m_fontVisible = false; | 3188 | m_fontVisible = false; |
3184 | e->ignore(); | 3189 | e->ignore(); |
3185 | return; | 3190 | return; |
3186 | } | 3191 | } |
3187 | if (regVisible) | 3192 | if (regVisible) |
3188 | { | 3193 | { |
3189 | regBar->hide(); | 3194 | regBar->hide(); |
3190 | #ifdef USEQPE | 3195 | #ifdef USEQPE |
3191 | Global::hideInputMethod(); | 3196 | Global::hideInputMethod(); |
3192 | #endif | 3197 | #endif |
3193 | regVisible = false; | 3198 | regVisible = false; |
3194 | e->ignore(); | 3199 | e->ignore(); |
3195 | return; | 3200 | return; |
3196 | } | 3201 | } |
3197 | if (searchVisible) | 3202 | if (searchVisible) |
3198 | { | 3203 | { |
3199 | searchBar->hide(); | 3204 | searchBar->hide(); |
3200 | #ifdef USEQPE | 3205 | #ifdef USEQPE |
3201 | Global::hideInputMethod(); | 3206 | Global::hideInputMethod(); |
3202 | #endif | 3207 | #endif |
3203 | searchVisible = false; | 3208 | searchVisible = false; |
3204 | e->ignore(); | 3209 | e->ignore(); |
3205 | return; | 3210 | return; |
3206 | } | 3211 | } |
3207 | if (m_fBkmksChanged && pBkmklist != NULL) | 3212 | if (m_fBkmksChanged && pBkmklist != NULL) |
3208 | { | 3213 | { |
3209 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) | 3214 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) |
3210 | savebkmks(); | 3215 | savebkmks(); |
3211 | delete pBkmklist; | 3216 | delete pBkmklist; |
3212 | reader->pBkmklist = pBkmklist = NULL; | 3217 | reader->pBkmklist = pBkmklist = NULL; |
3213 | m_fBkmksChanged = false; | 3218 | m_fBkmksChanged = false; |
3214 | } | 3219 | } |
3215 | updatefileinfo(); | 3220 | updatefileinfo(); |
3216 | saveprefs(); | 3221 | saveprefs(); |
3217 | e->accept(); | 3222 | e->accept(); |
3218 | } | 3223 | } |
3219 | } | 3224 | } |
3220 | else | 3225 | else |
3221 | { | 3226 | { |
3222 | showEditTools(); | 3227 | showEditTools(); |
3223 | m_disableesckey = true; | 3228 | m_disableesckey = true; |
3224 | } | 3229 | } |
3225 | } | 3230 | } |
3226 | } | 3231 | } |
3227 | 3232 | ||
3228 | void QTReaderApp::do_gotomark() | 3233 | void QTReaderApp::do_gotomark() |
3229 | { | 3234 | { |
3230 | m_nBkmkAction = cGotoBkmk; | 3235 | m_nBkmkAction = cGotoBkmk; |
3231 | if (!listbkmk(pBkmklist)) | 3236 | if (!listbkmk(pBkmklist)) |
3232 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); | 3237 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); |
3233 | } | 3238 | } |
3234 | 3239 | ||
3235 | void QTReaderApp::do_delmark() | 3240 | void QTReaderApp::do_delmark() |
3236 | { | 3241 | { |
3237 | m_nBkmkAction = cDelBkmk; | 3242 | m_nBkmkAction = cDelBkmk; |
3238 | if (!listbkmk(pBkmklist)) | 3243 | if (!listbkmk(pBkmklist)) |
3239 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); | 3244 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); |
3240 | } | 3245 | } |
3241 | 3246 | ||
3242 | bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab, bool presel) | 3247 | bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab, bool presel) |
3243 | { | 3248 | { |
3244 | bkmkselector->clear(); | 3249 | bkmkselector->clear(); |
3245 | if (_lab.isEmpty()) | 3250 | if (_lab.isEmpty()) |
3246 | bkmkselector->setText("Cancel"); | 3251 | bkmkselector->setText("Cancel"); |
3247 | else | 3252 | else |
3248 | bkmkselector->setText(_lab); | 3253 | bkmkselector->setText(_lab); |
3249 | int cnt = 0; | 3254 | int cnt = 0; |
3250 | int slt = -1; | 3255 | int slt = -1; |
3251 | if (plist != NULL) | 3256 | if (plist != NULL) |
3252 | { | 3257 | { |
3253 | for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) | 3258 | for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) |
3254 | { | 3259 | { |
3255 | if (presel) | 3260 | if (presel) |
3256 | { | 3261 | { |
3257 | Bkmk* p = i.pContent(); | 3262 | Bkmk* p = i.pContent(); |
3258 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) | 3263 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) |
3259 | { | 3264 | { |
3260 | slt = cnt; | 3265 | slt = cnt; |
3261 | } | 3266 | } |
3262 | } | 3267 | } |
3263 | #ifdef _UNICODE | 3268 | #ifdef _UNICODE |
3264 | // qDebug("Item:%s", (const char*)toQString(i->name())); | 3269 | // qDebug("Item:%s", (const char*)toQString(i->name())); |
3265 | bkmkselector->insertItem(toQString(i->name()), cnt++); | 3270 | bkmkselector->insertItem(toQString(i->name()), cnt++); |
3266 | #else | 3271 | #else |
3267 | bkmkselector->insertItem(i->name(), cnt++); | 3272 | bkmkselector->insertItem(i->name(), cnt++); |
3268 | #endif | 3273 | #endif |
3269 | 3274 | ||
3270 | } | 3275 | } |
3271 | } | 3276 | } |
3272 | if (cnt > 0) | 3277 | if (cnt > 0) |
3273 | { | 3278 | { |
3274 | hidetoolbars(); | 3279 | hidetoolbars(); |
3275 | editorStack->raiseWidget( bkmkselector ); | 3280 | editorStack->raiseWidget( bkmkselector ); |
3276 | if (slt != -1) bkmkselector->setCurrentItem(slt); | 3281 | if (slt != -1) bkmkselector->setCurrentItem(slt); |
3277 | return true; | 3282 | return true; |
3278 | } | 3283 | } |
3279 | else | 3284 | else |
3280 | return false; | 3285 | return false; |
3281 | } | 3286 | } |
3282 | 3287 | ||
3283 | void QTReaderApp::do_autogen() | 3288 | void QTReaderApp::do_autogen() |
3284 | { | 3289 | { |
3285 | m_nRegAction = cAutoGen; | 3290 | m_nRegAction = cAutoGen; |
3286 | regEdit->setText(m_autogenstr); | 3291 | regEdit->setText(m_autogenstr); |
3287 | do_regedit(); | 3292 | do_regedit(); |
3288 | } | 3293 | } |
3289 | 3294 | ||
3290 | void QTReaderApp::do_regedit() | 3295 | void QTReaderApp::do_regedit() |
3291 | { | 3296 | { |
3292 | // fileBar->hide(); | 3297 | // fileBar->hide(); |
3293 | reader->bDoUpdates = false; | 3298 | reader->bDoUpdates = false; |
3294 | // qDebug("Showing regbar"); | 3299 | // qDebug("Showing regbar"); |
3295 | regBar->show(); | 3300 | regBar->show(); |
3296 | // qDebug("Showing kbd"); | 3301 | // qDebug("Showing kbd"); |
3297 | #ifdef USEQPE | 3302 | #ifdef USEQPE |
3298 | Global::showInputMethod(); | 3303 | Global::showInputMethod(); |
3299 | #endif | 3304 | #endif |
3300 | regVisible = true; | 3305 | regVisible = true; |
3301 | regEdit->setFocus(); | 3306 | regEdit->setFocus(); |
3302 | // qApp->processEvents(); | 3307 | // qApp->processEvents(); |
3303 | reader->bDoUpdates = true; | 3308 | reader->bDoUpdates = true; |
3304 | reader->update(); | 3309 | reader->update(); |
3305 | } | 3310 | } |
3306 | 3311 | ||
3307 | bool QTReaderApp::openfrombkmk(Bkmk* bk) | 3312 | bool QTReaderApp::openfrombkmk(Bkmk* bk) |
3308 | { | 3313 | { |
3309 | QString fn = toQString( | 3314 | QString fn = toQString( |
3310 | CFiledata(bk->anno()).name() | 3315 | CFiledata(bk->anno()).name() |
3311 | ); | 3316 | ); |
3312 | //qDebug("fileinfo"); | 3317 | //qDebug("fileinfo"); |
3313 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) | 3318 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) |
3314 | { | 3319 | { |
3315 | //qDebug("Opening"); | 3320 | //qDebug("Opening"); |
3316 | struct stat fnstat; | 3321 | struct stat fnstat; |
3317 | stat((const char *)fn, &fnstat); | 3322 | stat((const char *)fn, &fnstat); |
3318 | 3323 | ||
3319 | if (CFiledata(bk->anno()).date() | 3324 | if (CFiledata(bk->anno()).date() |
3320 | != fnstat.st_mtime) | 3325 | != fnstat.st_mtime) |
3321 | { | 3326 | { |
3322 | CFiledata fd(bk->anno()); | 3327 | CFiledata fd(bk->anno()); |
3323 | fd.setdate(fnstat.st_mtime); | 3328 | fd.setdate(fnstat.st_mtime); |
3324 | bk->value(0); | 3329 | bk->value(0); |
3325 | reader->m_lastposn = 0; | 3330 | reader->m_lastposn = 0; |
3326 | openFile(fn); | 3331 | openFile(fn); |
3327 | } | 3332 | } |
3328 | else | 3333 | else |
3329 | { | 3334 | { |
3330 | unsigned short svlen = bk->filedatalen(); | 3335 | unsigned short svlen = bk->filedatalen(); |
3331 | unsigned char* svdata = bk->filedata(); | 3336 | unsigned char* svdata = bk->filedata(); |
3332 | openFile(fn, bk->value()); | 3337 | openFile(fn, bk->value()); |
3333 | reader->putSaveData(svdata, svlen); | 3338 | reader->putSaveData(svdata, svlen); |
3334 | // setstate(svdata, svlen); | 3339 | // setstate(svdata, svlen); |
3335 | if (svlen != 0) | 3340 | if (svlen != 0) |
3336 | { | 3341 | { |
3337 | QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); | 3342 | QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); |
3338 | } | 3343 | } |
3339 | // qDebug("updating"); | 3344 | // qDebug("updating"); |
3340 | // showEditTools(); | 3345 | // showEditTools(); |
3341 | } | 3346 | } |
3342 | return true; | 3347 | return true; |
3343 | } | 3348 | } |
3344 | else | 3349 | else |
3345 | { | 3350 | { |
3346 | return false; | 3351 | return false; |
3347 | } | 3352 | } |
3348 | } | 3353 | } |
3349 | 3354 | ||
3350 | void QTReaderApp::gotobkmk(int ind) | 3355 | void QTReaderApp::gotobkmk(int ind) |
3351 | { | 3356 | { |
3352 | qDebug("gbkmk"); | 3357 | qDebug("gbkmk"); |
3353 | showEditTools(); | 3358 | showEditTools(); |
3354 | switch (m_nBkmkAction) | 3359 | switch (m_nBkmkAction) |
3355 | { | 3360 | { |
3356 | case cOpenFile: | 3361 | case cOpenFile: |
3357 | { | 3362 | { |
3358 | // qApp->processEvents(); | 3363 | // qApp->processEvents(); |
3359 | if (!openfrombkmk((*pOpenlist)[ind])) | 3364 | if (!openfrombkmk((*pOpenlist)[ind])) |
3360 | { | 3365 | { |
3361 | pOpenlist->erase(ind); | 3366 | pOpenlist->erase(ind); |
3362 | QMessageBox::information(this, PROGNAME, "Can't find file"); | 3367 | QMessageBox::information(this, PROGNAME, "Can't find file"); |
3363 | } | 3368 | } |
3364 | } | 3369 | } |
3365 | break; | 3370 | break; |
3366 | case cGotoBkmk: | 3371 | case cGotoBkmk: |
3367 | reader->buffdoc.saveposn(reader->m_lastfile, reader->pagelocate()); | 3372 | reader->buffdoc.saveposn(reader->m_lastfile, reader->pagelocate()); |
3368 | reader->locate((*pBkmklist)[ind]->value()); | 3373 | reader->locate((*pBkmklist)[ind]->value()); |
3369 | break; | 3374 | break; |
3370 | case cDelBkmk: | 3375 | case cDelBkmk: |
3371 | //// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name()); | 3376 | //// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name()); |
3372 | pBkmklist->erase(ind); | 3377 | pBkmklist->erase(ind); |
3373 | m_fBkmksChanged = true; | 3378 | m_fBkmksChanged = true; |
3374 | reader->refresh(true); | 3379 | reader->refresh(true); |
3375 | // pBkmklist->sort(); | 3380 | // pBkmklist->sort(); |
3376 | break; | 3381 | break; |
3377 | case cRmBkmkFile: | 3382 | case cRmBkmkFile: |
3378 | { | 3383 | { |
3379 | #ifndef USEQPE | 3384 | #ifndef USEQPE |
3380 | QDir d = QDir::home(); // "/" | 3385 | QDir d = QDir::home(); // "/" |
3381 | d.cd(APPDIR); | 3386 | d.cd(APPDIR); |
3382 | d.remove(bkmkselector->text(ind)); | 3387 | d.remove(bkmkselector->text(ind)); |
3383 | #else /* USEQPE */ | 3388 | #else /* USEQPE */ |
3384 | unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind))); | 3389 | unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind))); |
3385 | #endif /* USEQPE */ | 3390 | #endif /* USEQPE */ |
3386 | } | 3391 | } |
3387 | break; | 3392 | break; |
3388 | case cLdConfig: | 3393 | case cLdConfig: |
3389 | readconfig(APPDIR "/configs", bkmkselector->text(ind), false); | 3394 | readconfig(APPDIR "/configs", bkmkselector->text(ind), false); |
3390 | break; | 3395 | break; |
3391 | case cLdTheme: | 3396 | case cLdTheme: |
3392 | m_themename = bkmkselector->text(ind); | 3397 | m_themename = bkmkselector->text(ind); |
3393 | readconfig(QString(APPDIR "/Themes/")+m_themename , "config", false); | 3398 | readconfig(QString(APPDIR "/Themes/")+m_themename , "config", false); |
3394 | setBackgroundBitmap(); | 3399 | setBackgroundBitmap(); |
3395 | break; | 3400 | break; |
3396 | case cRmConfig: | 3401 | case cRmConfig: |
3397 | { | 3402 | { |
3398 | #ifndef USEQPE | 3403 | #ifndef USEQPE |
3399 | QDir d = QDir::home(); // "/" | 3404 | QDir d = QDir::home(); // "/" |
3400 | d.cd(APPDIR "/configs"); | 3405 | d.cd(APPDIR "/configs"); |
3401 | d.remove(bkmkselector->text(ind)); | 3406 | d.remove(bkmkselector->text(ind)); |
3402 | #else /* USEQPE */ | 3407 | #else /* USEQPE */ |
3403 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",bkmkselector->text(ind))); | 3408 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",bkmkselector->text(ind))); |
3404 | #endif /* USEQPE */ | 3409 | #endif /* USEQPE */ |
3405 | } | 3410 | } |
3406 | break; | 3411 | break; |
3407 | case cExportLinks: | 3412 | case cExportLinks: |
3408 | { | 3413 | { |
3409 | #ifndef USEQPE | 3414 | #ifndef USEQPE |
3410 | QDir d = QDir::home(); // "/" | 3415 | QDir d = QDir::home(); // "/" |
3411 | d.cd(APPDIR "/urls"); | 3416 | d.cd(APPDIR "/urls"); |
3412 | QFileInfo fi(d, bkmkselector->text(ind)); | 3417 | QFileInfo fi(d, bkmkselector->text(ind)); |
3413 | if (fi.exists()) | 3418 | if (fi.exists()) |
3414 | { | 3419 | { |
3415 | QString outfile( QFileDialog::getSaveFileName( QString::null, QString::null, this ) ); | 3420 | QString outfile( QFileDialog::getSaveFileName( QString::null, QString::null, this ) ); |
3416 | if (!outfile.isEmpty()) | 3421 | if (!outfile.isEmpty()) |
3417 | { | 3422 | { |
3418 | FILE* fout = fopen((const char *)outfile, "w"); | 3423 | FILE* fout = fopen((const char *)outfile, "w"); |
3419 | if (fout != NULL) | 3424 | if (fout != NULL) |
3420 | { | 3425 | { |
3421 | FILE* fin = fopen((const char *)fi.absFilePath(), "r"); | 3426 | FILE* fin = fopen((const char *)fi.absFilePath(), "r"); |
3422 | if (fin != NULL) | 3427 | if (fin != NULL) |
3423 | { | 3428 | { |
3424 | fprintf(fout, "<html><body>\n"); | 3429 | fprintf(fout, "<html><body>\n"); |
3425 | int ch = 0; | 3430 | int ch = 0; |
3426 | while ((ch = fgetc(fin)) != EOF) | 3431 | while ((ch = fgetc(fin)) != EOF) |
3427 | { | 3432 | { |
3428 | fputc(ch, fout); | 3433 | fputc(ch, fout); |
3429 | } | 3434 | } |
3430 | fclose(fin); | 3435 | fclose(fin); |
3431 | fprintf(fout, "</html></body>\n"); | 3436 | fprintf(fout, "</html></body>\n"); |
3432 | d.remove(bkmkselector->text(ind)); | 3437 | d.remove(bkmkselector->text(ind)); |
3433 | } | 3438 | } |
3434 | fclose(fout); | 3439 | fclose(fout); |
3435 | } | 3440 | } |
3436 | else | 3441 | else |
3437 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); | 3442 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); |
3438 | } | 3443 | } |
3439 | } | 3444 | } |
3440 | #else /* USEQPE */ | 3445 | #else /* USEQPE */ |
3441 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); | 3446 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); |
3442 | if (fin != NULL) | 3447 | if (fin != NULL) |
3443 | { | 3448 | { |
3444 | bool allok = false; | 3449 | bool allok = false; |
3445 | #if defined(OPIE) && defined(OPIEFILEDIALOG) | 3450 | #if defined(OPIE) && defined(OPIEFILEDIALOG) |
3446 | QString outfile = OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null, QString::null, MimeTypes(), 0, "OpieReader"); | 3451 | QString outfile = OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null, QString::null, MimeTypes(), 0, "OpieReader"); |
3447 | if (!outfile.isEmpty()) | 3452 | if (!outfile.isEmpty()) |
3448 | { | 3453 | { |
3449 | FILE* fout = fopen((const char *)outfile, "w"); | 3454 | FILE* fout = fopen((const char *)outfile, "w"); |
3450 | if (fout != NULL) | 3455 | if (fout != NULL) |
3451 | { | 3456 | { |
3452 | fprintf(fout, "<html><body>\n"); | 3457 | fprintf(fout, "<html><body>\n"); |
3453 | int ch = 0; | 3458 | int ch = 0; |
3454 | while ((ch = fgetc(fin)) != EOF) | 3459 | while ((ch = fgetc(fin)) != EOF) |
3455 | { | 3460 | { |
3456 | fputc(ch, fout); | 3461 | fputc(ch, fout); |
3457 | } | 3462 | } |
3458 | fprintf(fout, "</html></body>\n"); | 3463 | fprintf(fout, "</html></body>\n"); |
3459 | fclose(fout); | 3464 | fclose(fout); |
3460 | allok = true; | 3465 | allok = true; |
3461 | } | 3466 | } |
3462 | else | 3467 | else |
3463 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); | 3468 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); |
3464 | } | 3469 | } |
3465 | fclose(fin); | 3470 | fclose(fin); |
3466 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); | 3471 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); |
3467 | #else | 3472 | #else |
3468 | fileBrowser* fb = new fileBrowser(true, this,"OpieReader",!m_bFloatingDialog, 0, "*", QString::null); | 3473 | fileBrowser* fb = new fileBrowser(true, this,"OpieReader",!m_bFloatingDialog, 0, "*", QString::null); |
3469 | if (fb->exec()) | 3474 | if (fb->exec()) |
3470 | { | 3475 | { |
3471 | QString outfile = fb->getCurrentFile(); | 3476 | QString outfile = fb->getCurrentFile(); |
3472 | FILE* fout = fopen((const char *)outfile, "w"); | 3477 | FILE* fout = fopen((const char *)outfile, "w"); |
3473 | if (fout != NULL) | 3478 | if (fout != NULL) |
3474 | { | 3479 | { |
3475 | fprintf(fout, "<html><body>\n"); | 3480 | fprintf(fout, "<html><body>\n"); |
3476 | int ch = 0; | 3481 | int ch = 0; |
3477 | while ((ch = fgetc(fin)) != EOF) | 3482 | while ((ch = fgetc(fin)) != EOF) |
3478 | { | 3483 | { |
3479 | fputc(ch, fout); | 3484 | fputc(ch, fout); |
3480 | } | 3485 | } |
3481 | fprintf(fout, "</html></body>\n"); | 3486 | fprintf(fout, "</html></body>\n"); |
3482 | fclose(fout); | 3487 | fclose(fout); |
3483 | allok = true; | 3488 | allok = true; |
3484 | } | 3489 | } |
3485 | else | 3490 | else |
3486 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); | 3491 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); |
3487 | } | 3492 | } |
3488 | delete fb; | 3493 | delete fb; |
3489 | fclose(fin); | 3494 | fclose(fin); |
3490 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); | 3495 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); |
3491 | #endif | 3496 | #endif |
3492 | } | 3497 | } |
3493 | else | 3498 | else |
3494 | { | 3499 | { |
3495 | QMessageBox::information(this, PROGNAME, "Couldn't open input"); | 3500 | QMessageBox::information(this, PROGNAME, "Couldn't open input"); |
3496 | } | 3501 | } |
3497 | 3502 | ||
3498 | /* | 3503 | /* |
3499 | CFileSelector *f = new CFileSelector("text/html", this, NULL, !m_bFloatingDialog, TRUE, TRUE ); | 3504 | CFileSelector *f = new CFileSelector("text/html", this, NULL, !m_bFloatingDialog, TRUE, TRUE ); |
3500 | int ret = f->exec(); | 3505 | int ret = f->exec(); |
3501 | qDebug("Return:%d", ret); | 3506 | qDebug("Return:%d", ret); |
3502 | DocLnk* doc = f->getDoc(); | 3507 | DocLnk* doc = f->getDoc(); |
3503 | if (doc != NULL) | 3508 | if (doc != NULL) |
3504 | { | 3509 | { |
3505 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); | 3510 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); |
3506 | QString rt; | 3511 | QString rt; |
3507 | rt = "<html><body>\n"; | 3512 | rt = "<html><body>\n"; |
3508 | int ch = 0; | 3513 | int ch = 0; |
3509 | while ((ch = fgetc(fin)) != EOF) | 3514 | while ((ch = fgetc(fin)) != EOF) |
3510 | { | 3515 | { |
3511 | rt += (char)ch; | 3516 | rt += (char)ch; |
3512 | } | 3517 | } |
3513 | fclose(fin); | 3518 | fclose(fin); |
3514 | rt += "</html></body>\n"; | 3519 | rt += "</html></body>\n"; |
3515 | if ( doc->name().isEmpty() ) | 3520 | if ( doc->name().isEmpty() ) |
3516 | { | 3521 | { |
3517 | doc->setName(bkmkselector->text(ind)); | 3522 | doc->setName(bkmkselector->text(ind)); |
3518 | } | 3523 | } |
3519 | FileManager fm; | 3524 | FileManager fm; |
3520 | fm.saveFile( *doc, rt ); | 3525 | fm.saveFile( *doc, rt ); |
3521 | qDebug("YES"); | 3526 | qDebug("YES"); |
3522 | } | 3527 | } |
3523 | else | 3528 | else |
3524 | { | 3529 | { |
3525 | qDebug("NO"); | 3530 | qDebug("NO"); |
3526 | } | 3531 | } |
3527 | delete f; | 3532 | delete f; |
3528 | */ | 3533 | */ |
3529 | 3534 | ||
3530 | #endif /* USEQPE */ | 3535 | #endif /* USEQPE */ |
3531 | } | 3536 | } |
3532 | break; | 3537 | break; |
3533 | } | 3538 | } |
3534 | } | 3539 | } |
3535 | 3540 | ||
3536 | void QTReaderApp::cancelbkmk() | 3541 | void QTReaderApp::cancelbkmk() |
3537 | { | 3542 | { |
3538 | if (m_nBkmkAction == cOpenFile) | 3543 | if (m_nBkmkAction == cOpenFile) |
3539 | { | 3544 | { |
3540 | QString fn = usefilebrowser(); | 3545 | QString fn = usefilebrowser(); |
3541 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn); | 3546 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn); |
3542 | } | 3547 | } |
3543 | showEditTools(); | 3548 | showEditTools(); |
3544 | } | 3549 | } |
3545 | 3550 | ||
3546 | void QTReaderApp::reparastring() | 3551 | void QTReaderApp::reparastring() |
3547 | { | 3552 | { |
3548 | m_nRegAction = cRepara; | 3553 | m_nRegAction = cRepara; |
3549 | regEdit->setText(reader->m_reparastring); | 3554 | regEdit->setText(reader->m_reparastring); |
3550 | do_regedit(); | 3555 | do_regedit(); |
3551 | } | 3556 | } |
3552 | 3557 | ||
3553 | void QTReaderApp::do_reparastring(const QString& _lcn) | 3558 | void QTReaderApp::do_reparastring(const QString& _lcn) |
3554 | { | 3559 | { |
3555 | reader->m_reparastring = _lcn; | 3560 | reader->m_reparastring = _lcn; |
3556 | if (reader->brepara) | 3561 | if (reader->brepara) |
3557 | { | 3562 | { |
3558 | reader->bDoUpdates = true; | 3563 | reader->bDoUpdates = true; |
3559 | reader->setfilter(reader->getfilter()); | 3564 | reader->setfilter(reader->getfilter()); |
3560 | } | 3565 | } |
3561 | } | 3566 | } |
3562 | 3567 | ||
3563 | void QTReaderApp::jump() | 3568 | void QTReaderApp::jump() |
3564 | { | 3569 | { |
3565 | m_nRegAction = cJump; | 3570 | m_nRegAction = cJump; |
3566 | char lcn[20]; | 3571 | char lcn[20]; |
3567 | sprintf(lcn, "%lu", reader->pagelocate()); | 3572 | sprintf(lcn, "%lu", reader->pagelocate()); |
3568 | regEdit->setText(lcn); | 3573 | regEdit->setText(lcn); |
3569 | do_regedit(); | 3574 | do_regedit(); |
3570 | } | 3575 | } |
3571 | 3576 | ||
3572 | void QTReaderApp::do_jump(const QString& _lcn) | 3577 | void QTReaderApp::do_jump(const QString& _lcn) |
3573 | { | 3578 | { |
3574 | bool ok; | 3579 | bool ok; |
3575 | QString lcn = _lcn.stripWhiteSpace(); | 3580 | QString lcn = _lcn.stripWhiteSpace(); |
3576 | unsigned long ulcn = lcn.toULong(&ok); | 3581 | unsigned long ulcn = lcn.toULong(&ok); |
3577 | if (!ok) | 3582 | if (!ok) |
3578 | { | 3583 | { |
3579 | double pc = 0.0; | 3584 | double pc = 0.0; |
3580 | #ifdef _WINDOWS | 3585 | #ifdef _WINDOWS |
3581 | if (lcn.at(lcn.length()-1) == '%') | 3586 | if (lcn.at(lcn.length()-1) == '%') |
3582 | #else | 3587 | #else |
3583 | if (lcn[lcn.length()-1] == '%') | 3588 | if (lcn[lcn.length()-1] == '%') |
3584 | #endif | 3589 | #endif |
3585 | { | 3590 | { |
3586 | lcn = lcn.left(lcn.length()-1); | 3591 | lcn = lcn.left(lcn.length()-1); |
3587 | pc = lcn.toDouble(&ok); | 3592 | pc = lcn.toDouble(&ok); |
3588 | } | 3593 | } |
3589 | else | 3594 | else |
3590 | { | 3595 | { |
3591 | pc = lcn.toDouble(&ok); | 3596 | pc = lcn.toDouble(&ok); |
3592 | } | 3597 | } |
3593 | if (ok && 0 <= pc && pc <= 100) | 3598 | if (ok && 0 <= pc && pc <= 100) |
3594 | { | 3599 | { |
3595 | ulcn = (pc*(reader->buffdoc.endSection()-reader->buffdoc.startSection()))/100 + reader->buffdoc.startSection(); | 3600 | ulcn = (pc*(reader->buffdoc.endSection()-reader->buffdoc.startSection()))/100 + reader->buffdoc.startSection(); |
3596 | } | 3601 | } |
3597 | else | 3602 | else |
3598 | { | 3603 | { |
3599 | ok = false; | 3604 | ok = false; |
3600 | } | 3605 | } |
3601 | } | 3606 | } |
3602 | if (ok) | 3607 | if (ok) |
3603 | reader->locate(ulcn); | 3608 | reader->locate(ulcn); |
3604 | else | 3609 | else |
3605 | QMessageBox::information(this, PROGNAME, "Must be a number\nor a percentage"); | 3610 | QMessageBox::information(this, PROGNAME, "Must be a number\nor a percentage"); |
3606 | } | 3611 | } |
3607 | 3612 | ||
3608 | void QTReaderApp::do_regaction() | 3613 | void QTReaderApp::do_regaction() |
3609 | { | 3614 | { |
3610 | reader->bDoUpdates = false; | 3615 | reader->bDoUpdates = false; |
3611 | regBar->hide(); | 3616 | regBar->hide(); |
3612 | #ifdef USEQPE | 3617 | #ifdef USEQPE |
3613 | Global::hideInputMethod(); | 3618 | Global::hideInputMethod(); |
3614 | #endif | 3619 | #endif |
3615 | regVisible = false; | 3620 | regVisible = false; |
3616 | switch(m_nRegAction) | 3621 | switch(m_nRegAction) |
3617 | { | 3622 | { |
3618 | case cAutoGen: | 3623 | case cAutoGen: |
3619 | do_autogen(regEdit->text()); | 3624 | do_autogen(regEdit->text()); |
3620 | break; | 3625 | break; |
3621 | case cAddBkmk: | 3626 | case cAddBkmk: |
3622 | do_addbkmk(regEdit->text()); | 3627 | do_addbkmk(regEdit->text()); |
3623 | break; | 3628 | break; |
3624 | case cRepara: | 3629 | case cRepara: |
3625 | do_reparastring(regEdit->text()); | 3630 | do_reparastring(regEdit->text()); |
3626 | break; | 3631 | break; |
3627 | case cJump: | 3632 | case cJump: |
3628 | do_jump(regEdit->text()); | 3633 | do_jump(regEdit->text()); |
3629 | break; | 3634 | break; |
3630 | /* | 3635 | /* |
3631 | case cMonoSpace: | 3636 | case cMonoSpace: |
3632 | do_mono(regEdit->text()); | 3637 | do_mono(regEdit->text()); |
3633 | break; | 3638 | break; |
3634 | */ | 3639 | */ |
3635 | case cSetTarget: | 3640 | case cSetTarget: |
3636 | do_settarget(regEdit->text()); | 3641 | do_settarget(regEdit->text()); |
3637 | break; | 3642 | break; |
3638 | #ifdef _SCROLLPIPE | 3643 | #ifdef _SCROLLPIPE |
3639 | case cSetPipeTarget: | 3644 | case cSetPipeTarget: |
3640 | do_setpipetarget(regEdit->text()); | 3645 | do_setpipetarget(regEdit->text()); |
3641 | break; | 3646 | break; |
3642 | #endif | 3647 | #endif |
3643 | case cSetConfigName: | 3648 | case cSetConfigName: |
3644 | // qDebug("Saving config"); | 3649 | // qDebug("Saving config"); |
3645 | do_saveconfig(regEdit->text(), false); | 3650 | do_saveconfig(regEdit->text(), false); |
3646 | break; | 3651 | break; |
3647 | } | 3652 | } |
3648 | // reader->restore(); | 3653 | // reader->restore(); |
3649 | // fileBar->show(); | 3654 | // fileBar->show(); |
3650 | reader->setFocus(); | 3655 | reader->setFocus(); |
3651 | // qApp->processEvents(); | 3656 | // qApp->processEvents(); |
3652 | reader->bDoUpdates = true; | 3657 | reader->bDoUpdates = true; |
3653 | reader->update(); | 3658 | reader->update(); |
3654 | } | 3659 | } |
3655 | 3660 | ||
3656 | void QTReaderApp::do_settarget(const QString& _txt) | 3661 | void QTReaderApp::do_settarget(const QString& _txt) |
3657 | { | 3662 | { |
3658 | int ind = _txt.find('/'); | 3663 | int ind = _txt.find('/'); |
3659 | if (ind == -1) | 3664 | if (ind == -1) |
3660 | { | 3665 | { |
3661 | m_targetapp = ""; | 3666 | m_targetapp = ""; |
3662 | m_targetmsg = ""; | 3667 | m_targetmsg = ""; |
3663 | QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename"); | 3668 | QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename"); |
3664 | } | 3669 | } |
3665 | else | 3670 | else |
3666 | { | 3671 | { |
3667 | m_targetapp = _txt.left(ind); | 3672 | m_targetapp = _txt.left(ind); |
3668 | m_targetmsg = _txt.right(_txt.length()-ind-1); | 3673 | m_targetmsg = _txt.right(_txt.length()-ind-1); |
3669 | } | 3674 | } |
3670 | } | 3675 | } |
3671 | 3676 | ||
3672 | void QTReaderApp::chooseencoding() | 3677 | void QTReaderApp::chooseencoding() |
3673 | { | 3678 | { |
3674 | m_fontSelector->clear(); | 3679 | m_fontSelector->clear(); |
3675 | m_fontSelector->insertItem("Ascii"); | 3680 | m_fontSelector->insertItem("Ascii"); |
3676 | m_fontSelector->insertItem("UTF-8"); | 3681 | m_fontSelector->insertItem("UTF-8"); |
3677 | m_fontSelector->insertItem("UCS-2(BE)"); | 3682 | m_fontSelector->insertItem("UCS-2(BE)"); |
3678 | m_fontSelector->insertItem("USC-2(LE)"); | 3683 | m_fontSelector->insertItem("USC-2(LE)"); |
3679 | m_fontSelector->insertItem("Palm"); | 3684 | m_fontSelector->insertItem("Palm"); |
3680 | for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++) | 3685 | for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++) |
3681 | { | 3686 | { |
3682 | m_fontSelector->insertItem(iter->mime); | 3687 | m_fontSelector->insertItem(iter->mime); |
3683 | } // delete the FontDatabase!!! | 3688 | } // delete the FontDatabase!!! |
3684 | m_fontSelector->setCurrentItem (reader->m_encd); | 3689 | m_fontSelector->setCurrentItem (reader->m_encd); |
3685 | m_fontAction = cChooseEncoding; | 3690 | m_fontAction = cChooseEncoding; |
3686 | m_fontBar->show(); | 3691 | m_fontBar->show(); |
3687 | m_fontVisible = true; | 3692 | m_fontVisible = true; |
3688 | } | 3693 | } |
3689 | 3694 | ||
3690 | void QTReaderApp::setfont() | 3695 | void QTReaderApp::setfont() |
3691 | { | 3696 | { |
3692 | m_fontSelector->clear(); | 3697 | m_fontSelector->clear(); |
3693 | { | 3698 | { |
3694 | QFontDatabase f; | 3699 | QFontDatabase f; |
3695 | QStringList flist = f.families(); | 3700 | QStringList flist = f.families(); |
3696 | m_fontSelector->insertStringList(flist); | 3701 | m_fontSelector->insertStringList(flist); |
3697 | } // delete the FontDatabase!!! | 3702 | } // delete the FontDatabase!!! |
3698 | 3703 | ||
3699 | for (int i = 1; i <= m_fontSelector->count(); i++) | 3704 | for (int i = 1; i <= m_fontSelector->count(); i++) |
3700 | { | 3705 | { |
3701 | if (m_fontSelector->text(i) == reader->m_fontname) | 3706 | if (m_fontSelector->text(i) == reader->m_fontname) |
3702 | { | 3707 | { |
3703 | m_fontSelector->setCurrentItem(i); | 3708 | m_fontSelector->setCurrentItem(i); |
3704 | break; | 3709 | break; |
3705 | } | 3710 | } |
3706 | } | 3711 | } |
3707 | m_fontAction = cChooseFont; | 3712 | m_fontAction = cChooseFont; |
3708 | m_fontBar->show(); | 3713 | m_fontBar->show(); |
3709 | m_fontVisible = true; | 3714 | m_fontVisible = true; |
3710 | } | 3715 | } |
3711 | 3716 | ||
3712 | void QTReaderApp::setfontHelper(const QString& lcn, int size) | 3717 | void QTReaderApp::setfontHelper(const QString& lcn, int size) |
3713 | { | 3718 | { |
3714 | if (size == 0) size = reader->m_fontControl.currentsize(); | 3719 | if (size == 0) size = reader->m_fontControl.currentsize(); |
3715 | if (m_propogatefontchange) | 3720 | if (m_propogatefontchange) |
3716 | { | 3721 | { |
3717 | QFont f(lcn, 10); | 3722 | QFont f(lcn, 10); |
3718 | bkmkselector->setFont( f ); | 3723 | bkmkselector->setFont( f ); |
3719 | regEdit->setFont( f ); | 3724 | regEdit->setFont( f ); |
3720 | searchEdit->setFont( f ); | 3725 | searchEdit->setFont( f ); |
3721 | m_annoWin->setFont( f ); | 3726 | m_annoWin->setFont( f ); |
3722 | } | 3727 | } |
3723 | reader->m_fontname = lcn; | 3728 | reader->m_fontname = lcn; |
3724 | if (!reader->ChangeFont(size)) | 3729 | if (!reader->ChangeFont(size)) |
3725 | { | 3730 | { |
3726 | reader->ChangeFont(size); | 3731 | reader->ChangeFont(size); |
3727 | } | 3732 | } |
3728 | } | 3733 | } |
3729 | 3734 | ||
3730 | void QTReaderApp::do_setencoding(int i) | 3735 | void QTReaderApp::do_setencoding(int i) |
3731 | { | 3736 | { |
3732 | qDebug("setencoding:%d", i); | 3737 | qDebug("setencoding:%d", i); |
3733 | if (m_fontAction == cChooseEncoding) | 3738 | if (m_fontAction == cChooseEncoding) |
3734 | { | 3739 | { |
3735 | reader->setencoding(i); | 3740 | reader->setencoding(i); |
3736 | } | 3741 | } |
3737 | reader->refresh(); | 3742 | reader->refresh(); |
3738 | m_fontBar->hide(); | 3743 | m_fontBar->hide(); |
3739 | m_fontVisible = false; | 3744 | m_fontVisible = false; |
3740 | // qDebug("showedit"); | 3745 | // qDebug("showedit"); |
3741 | if (reader->isVisible()) showEditTools(); | 3746 | if (reader->isVisible()) showEditTools(); |
3742 | // qDebug("showeditdone"); | 3747 | // qDebug("showeditdone"); |
3743 | } | 3748 | } |
3744 | 3749 | ||
3745 | void QTReaderApp::do_setfont(const QString& lcn) | 3750 | void QTReaderApp::do_setfont(const QString& lcn) |
3746 | { | 3751 | { |
3747 | if (m_fontAction == cChooseFont) | 3752 | if (m_fontAction == cChooseFont) |
3748 | { | 3753 | { |
3749 | setfontHelper(lcn); | 3754 | setfontHelper(lcn); |
3750 | } | 3755 | } |
3751 | reader->refresh(); | 3756 | reader->refresh(); |
3752 | m_fontBar->hide(); | 3757 | m_fontBar->hide(); |
3753 | m_fontVisible = false; | 3758 | m_fontVisible = false; |
3754 | // qDebug("setfont"); | 3759 | // qDebug("setfont"); |
3755 | //if (reader->isVisible()) | 3760 | //if (reader->isVisible()) |
3756 | showEditTools(); | 3761 | showEditTools(); |
3757 | // qDebug("showeditdone"); | 3762 | // qDebug("showeditdone"); |
3758 | } | 3763 | } |
3759 | 3764 | ||
3760 | void QTReaderApp::do_autogen(const QString& regText) | 3765 | void QTReaderApp::do_autogen(const QString& regText) |
3761 | { | 3766 | { |
3762 | unsigned long fs, ts; | 3767 | unsigned long fs, ts; |
3763 | reader->sizes(fs,ts); | 3768 | reader->sizes(fs,ts); |
3764 | // // qDebug("Reg:%s\n", (const tchar*)(regEdit->text())); | 3769 | // // qDebug("Reg:%s\n", (const tchar*)(regEdit->text())); |
3765 | m_autogenstr = regText; | 3770 | m_autogenstr = regText; |
3766 | QRegExp re(regText); | 3771 | QRegExp re(regText); |
3767 | CBuffer buff; | 3772 | CBuffer buff; |
3768 | if (pBkmklist != NULL) delete pBkmklist; | 3773 | if (pBkmklist != NULL) delete pBkmklist; |
3769 | reader->pBkmklist = pBkmklist = new CList<Bkmk>; | 3774 | reader->pBkmklist = pBkmklist = new CList<Bkmk>; |
3770 | m_fBkmksChanged = true; | 3775 | m_fBkmksChanged = true; |
3771 | 3776 | ||
3772 | pbar->setGeometry(regBar->x(),regBar->y(),regBar->width(), regBar->height()); | 3777 | pbar->setGeometry(regBar->x(),regBar->y(),regBar->width(), regBar->height()); |
3773 | pbar->show(); | 3778 | pbar->show(); |
3774 | pbar->raise(); | 3779 | pbar->raise(); |
3775 | pbar->reset(); | 3780 | pbar->reset(); |
3776 | reader->update(); | 3781 | reader->update(); |
3777 | qApp->processEvents(); | 3782 | qApp->processEvents(); |
3778 | reader->setFocus(); | 3783 | reader->setFocus(); |
3779 | reader->jumpto(0); | 3784 | reader->jumpto(0); |
3780 | int lastpc = 0; | 3785 | int lastpc = 0; |
3781 | int i = 0; | 3786 | int i = 0; |
3782 | unsigned int llcn = reader->locate(); | 3787 | unsigned int llcn = reader->locate(); |
3783 | while (i >= 0) | 3788 | while (i >= 0) |
3784 | { | 3789 | { |
3785 | unsigned int lcn = llcn; | 3790 | unsigned int lcn = llcn; |
3786 | int pc = (100*lcn)/ts; | 3791 | int pc = (100*lcn)/ts; |
3787 | if (pc != lastpc) | 3792 | if (pc != lastpc) |
3788 | { | 3793 | { |
3789 | pbar->setProgress(pc); | 3794 | pbar->setProgress(pc); |
3790 | qApp->processEvents(); | 3795 | qApp->processEvents(); |
3791 | if (reader->locate() != lcn) reader->jumpto(lcn); | 3796 | if (reader->locate() != lcn) reader->jumpto(lcn); |
3792 | reader->setFocus(); | 3797 | reader->setFocus(); |
3793 | lastpc = pc; | 3798 | lastpc = pc; |
3794 | } | 3799 | } |
3795 | i = reader->buffdoc.getpara(buff); | 3800 | i = reader->buffdoc.getpara(buff); |
3796 | #ifdef _UNICODE | 3801 | #ifdef _UNICODE |
3797 | if (re.match(toQString(buff.data())) != -1) | 3802 | if (re.match(toQString(buff.data())) != -1) |
3798 | #else | 3803 | #else |
3799 | if (re.match(buff.data()) != -1) | 3804 | if (re.match(buff.data()) != -1) |
3800 | #endif | 3805 | #endif |
3801 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); | 3806 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); |
3802 | /* | 3807 | /* |
3803 | llcn = reader->locate(); | 3808 | llcn = reader->locate(); |
3804 | if ((i == 0) && (llcn+1 < ts)) | 3809 | if ((i == 0) && (llcn+1 < ts)) |
3805 | { | 3810 | { |
3806 | reader->jumpto(++llcn); | 3811 | reader->jumpto(++llcn); |
3807 | i = 1; | 3812 | i = 1; |
3808 | } | 3813 | } |
3809 | */ | 3814 | */ |
3810 | } | 3815 | } |
3811 | pBkmklist->sort(); | 3816 | pBkmklist->sort(); |
3812 | pbar->setProgress(100); | 3817 | pbar->setProgress(100); |
3813 | qApp->processEvents(); | 3818 | qApp->processEvents(); |
3814 | pbar->hide(); | 3819 | pbar->hide(); |
3815 | reader->refresh(); | 3820 | reader->refresh(); |
3816 | } | 3821 | } |
3817 | 3822 | ||
3818 | void QTReaderApp::saveprefs() | 3823 | void QTReaderApp::saveprefs() |
3819 | { | 3824 | { |
3820 | do_saveconfig( APPDIR, true ); | 3825 | do_saveconfig( APPDIR, true ); |
3821 | savefilelist(); | 3826 | savefilelist(); |
3822 | } | 3827 | } |
3823 | 3828 | ||
3824 | /* | 3829 | /* |
3825 | void QTReaderApp::oldFile() | 3830 | void QTReaderApp::oldFile() |
3826 | { | 3831 | { |
3827 | // qDebug("oldFile called"); | 3832 | // qDebug("oldFile called"); |
3828 | reader->setText(true); | 3833 | reader->setText(true); |
3829 | // qDebug("settext called"); | 3834 | // qDebug("settext called"); |
3830 | showEditTools(); | 3835 | showEditTools(); |
3831 | // qDebug("showedit called"); | 3836 | // qDebug("showedit called"); |
3832 | } | 3837 | } |
3833 | */ | 3838 | */ |
3834 | 3839 | ||
3835 | /* | 3840 | /* |
3836 | void info_cb(Fl_Widget* o, void* _data) | 3841 | void info_cb(Fl_Widget* o, void* _data) |
3837 | { | 3842 | { |
3838 | 3843 | ||
3839 | if (infowin == NULL) | 3844 | if (infowin == NULL) |
3840 | { | 3845 | { |
3841 | 3846 | ||
3842 | infowin = new Fl_Window(160,240); | 3847 | infowin = new Fl_Window(160,240); |
3843 | filename = new Fl_Output(45,5,110,14,"Filename"); | 3848 | filename = new Fl_Output(45,5,110,14,"Filename"); |
3844 | filesize = new Fl_Output(45,25,110,14,"Filesize"); | 3849 | filesize = new Fl_Output(45,25,110,14,"Filesize"); |
3845 | textsize = new Fl_Output(45,45,110,14,"Textsize"); | 3850 | textsize = new Fl_Output(45,45,110,14,"Textsize"); |
3846 | comprat = new CBar(45,65,110,14,"Ratio %"); | 3851 | comprat = new CBar(45,65,110,14,"Ratio %"); |
3847 | posn = new Fl_Output(45,85,110,14,"Location"); | 3852 | posn = new Fl_Output(45,85,110,14,"Location"); |
3848 | frcn = new CBar(45,105,110,14,"% Read"); | 3853 | frcn = new CBar(45,105,110,14,"% Read"); |
3849 | about = new Fl_Multiline_Output(5,125,150,90); | 3854 | about = new Fl_Multiline_Output(5,125,150,90); |
3850 | about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files"); | 3855 | about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files"); |
3851 | Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay"); | 3856 | Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay"); |
3852 | infowin->set_modal(); | 3857 | infowin->set_modal(); |
3853 | } | 3858 | } |
3854 | if (((reader_ui *)_data)->g_filename[0] != '\0') | 3859 | if (((reader_ui *)_data)->g_filename[0] != '\0') |
3855 | { | 3860 | { |
3856 | unsigned long fs,ts; | 3861 | unsigned long fs,ts; |
3857 | tchar sz[20]; | 3862 | tchar sz[20]; |
3858 | ((reader_ui *)_data)->input->sizes(fs,ts); | 3863 | ((reader_ui *)_data)->input->sizes(fs,ts); |
3859 | unsigned long pl = ((reader_ui *)_data)->input->locate(); | 3864 | unsigned long pl = ((reader_ui *)_data)->input->locate(); |
3860 | 3865 | ||
3861 | filename->value(((reader_ui *)_data)->g_filename); | 3866 | filename->value(((reader_ui *)_data)->g_filename); |
3862 | 3867 | ||
3863 | sprintf(sz,"%u",fs); | 3868 | sprintf(sz,"%u",fs); |
3864 | filesize->value(sz); | 3869 | filesize->value(sz); |
3865 | 3870 | ||
3866 | sprintf(sz,"%u",ts); | 3871 | sprintf(sz,"%u",ts); |
3867 | textsize->value(sz); | 3872 | textsize->value(sz); |
3868 | 3873 | ||
3869 | comprat->value(100-(100*fs + (ts >> 1))/ts); | 3874 | comprat->value(100-(100*fs + (ts >> 1))/ts); |
3870 | 3875 | ||
3871 | sprintf(sz,"%u",pl); | 3876 | sprintf(sz,"%u",pl); |
3872 | posn->value(sz); | 3877 | posn->value(sz); |
3873 | 3878 | ||
3874 | frcn->value((100*pl + (ts >> 1))/ts); | 3879 | frcn->value((100*pl + (ts >> 1))/ts); |
3875 | } | 3880 | } |
3876 | infowin->show(); | 3881 | infowin->show(); |
3877 | } | 3882 | } |
3878 | */ | 3883 | */ |
3879 | 3884 | ||
3880 | void QTReaderApp::savebkmks() | 3885 | void QTReaderApp::savebkmks() |
3881 | { | 3886 | { |
3882 | if (pBkmklist != NULL) | 3887 | if (pBkmklist != NULL) |
3883 | { | 3888 | { |
3884 | #ifndef USEQPE | 3889 | #ifndef USEQPE |
3885 | QDir d = QDir::home(); // "/" | 3890 | QDir d = QDir::home(); // "/" |
3886 | d.cd(APPDIR); | 3891 | d.cd(APPDIR); |
3887 | QFileInfo fi(d, reader->m_string); | 3892 | QFileInfo fi(d, reader->m_string); |
3888 | BkmkFile bf((const char *)fi.absFilePath(), true, true); | 3893 | BkmkFile bf((const char *)fi.absFilePath(), true, true); |
3889 | #else /* USEQPE */ | 3894 | #else /* USEQPE */ |
3890 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), true, true); | 3895 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), true, true); |
3891 | #endif /* USEQPE */ | 3896 | #endif /* USEQPE */ |
3892 | bf.write(*pBkmklist); | 3897 | bf.write(*pBkmklist); |
3893 | } | 3898 | } |
3894 | m_fBkmksChanged = false; | 3899 | m_fBkmksChanged = false; |
3895 | } | 3900 | } |
3896 | 3901 | ||
3897 | void QTReaderApp::readfilelist() | 3902 | void QTReaderApp::readfilelist() |
3898 | { | 3903 | { |
3899 | #ifndef USEQPE | 3904 | #ifndef USEQPE |
3900 | QDir d = QDir::home(); // "/" | 3905 | QDir d = QDir::home(); // "/" |
3901 | d.cd(APPDIR); | 3906 | d.cd(APPDIR); |
3902 | QFileInfo fi(d, ".openfiles"); | 3907 | QFileInfo fi(d, ".openfiles"); |
3903 | BkmkFile bf((const char *)fi.absFilePath(), false, false); | 3908 | BkmkFile bf((const char *)fi.absFilePath(), false, false); |
3904 | #else /* USEQPE */ | 3909 | #else /* USEQPE */ |
3905 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), false, false); | 3910 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), false, false); |
3906 | #endif /* USEQPE */ | 3911 | #endif /* USEQPE */ |
3907 | // qDebug("Reading open files"); | 3912 | // qDebug("Reading open files"); |
3908 | pOpenlist = bf.readall(); | 3913 | pOpenlist = bf.readall(); |
3909 | // if (pOpenlist != NULL) qDebug("...with success"); | 3914 | // if (pOpenlist != NULL) qDebug("...with success"); |
3910 | // else qDebug("...without success!"); | 3915 | // else qDebug("...without success!"); |
3911 | } | 3916 | } |
3912 | 3917 | ||
3913 | void QTReaderApp::savefilelist() | 3918 | void QTReaderApp::savefilelist() |
3914 | { | 3919 | { |
3915 | if (pOpenlist != NULL) | 3920 | if (pOpenlist != NULL) |
3916 | { | 3921 | { |
3917 | #ifndef USEQPE | 3922 | #ifndef USEQPE |
3918 | QDir d = QDir::home(); // "/" | 3923 | QDir d = QDir::home(); // "/" |
3919 | d.cd(APPDIR); | 3924 | d.cd(APPDIR); |
3920 | QFileInfo fi(d, ".openfiles"); | 3925 | QFileInfo fi(d, ".openfiles"); |
3921 | BkmkFile bf((const char *)fi.absFilePath(), true, false); | 3926 | BkmkFile bf((const char *)fi.absFilePath(), true, false); |
3922 | #else /* USEQPE */ | 3927 | #else /* USEQPE */ |
3923 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true, false); | 3928 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true, false); |
3924 | #endif /* USEQPE */ | 3929 | #endif /* USEQPE */ |
3925 | //qDebug("Writing open files"); | 3930 | //qDebug("Writing open files"); |
3926 | bf.write(*pOpenlist); | 3931 | bf.write(*pOpenlist); |
3927 | } | 3932 | } |
3928 | } | 3933 | } |
3929 | 3934 | ||
3930 | void QTReaderApp::readbkmks() | 3935 | void QTReaderApp::readbkmks() |
3931 | { | 3936 | { |
3932 | if (pBkmklist != NULL) | 3937 | if (pBkmklist != NULL) |
3933 | { | 3938 | { |
3934 | delete pBkmklist; | 3939 | delete pBkmklist; |
3935 | } | 3940 | } |
3936 | struct stat fnstat; | 3941 | struct stat fnstat; |
3937 | struct stat bkstat; | 3942 | struct stat bkstat; |
3938 | #ifndef USEQPE | 3943 | #ifndef USEQPE |
3939 | QDir d = QDir::home(); // "/" | 3944 | QDir d = QDir::home(); // "/" |
3940 | d.cd(APPDIR); | 3945 | d.cd(APPDIR); |
3941 | QFileInfo fi(d, reader->m_string); | 3946 | QFileInfo fi(d, reader->m_string); |
3942 | #endif /* ! USEQPE */ | 3947 | #endif /* ! USEQPE */ |
3943 | if ( | 3948 | if ( |
3944 | stat((const char *)reader->m_lastfile, &fnstat) == 0 | 3949 | stat((const char *)reader->m_lastfile, &fnstat) == 0 |
3945 | && | 3950 | && |
3946 | #ifndef USEQPE | 3951 | #ifndef USEQPE |
3947 | stat((const char *)fi.absFilePath(), &bkstat) == 0 | 3952 | stat((const char *)fi.absFilePath(), &bkstat) == 0 |
3948 | #else /* USEQPE */ | 3953 | #else /* USEQPE */ |
3949 | stat((const char *)Global::applicationFileName(APPDIR,reader->m_string), &bkstat) == 0 | 3954 | stat((const char *)Global::applicationFileName(APPDIR,reader->m_string), &bkstat) == 0 |
3950 | #endif /* USEQPE */ | 3955 | #endif /* USEQPE */ |
3951 | ) | 3956 | ) |
3952 | { | 3957 | { |
3953 | if (bkstat.st_mtime < fnstat.st_mtime) | 3958 | if (bkstat.st_mtime < fnstat.st_mtime) |
3954 | { | 3959 | { |
3955 | #ifndef USEQPE | 3960 | #ifndef USEQPE |
3956 | unlink((const char *)fi.absFilePath()); | 3961 | unlink((const char *)fi.absFilePath()); |
3957 | #else /* USEQPE */ | 3962 | #else /* USEQPE */ |
3958 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); | 3963 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); |
3959 | #endif /* USEQPE */ | 3964 | #endif /* USEQPE */ |
3960 | } | 3965 | } |
3961 | } | 3966 | } |
3962 | 3967 | ||
3963 | #ifndef USEQPE | 3968 | #ifndef USEQPE |
3964 | BkmkFile bf((const char *)fi.absFilePath(), false, true); | 3969 | BkmkFile bf((const char *)fi.absFilePath(), false, true); |
3965 | #else /* USEQPE */ | 3970 | #else /* USEQPE */ |
3966 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), false, true); | 3971 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), false, true); |
3967 | #endif /* USEQPE */ | 3972 | #endif /* USEQPE */ |
3968 | 3973 | ||
3969 | reader->pBkmklist = pBkmklist = bf.readall(); | 3974 | reader->pBkmklist = pBkmklist = bf.readall(); |
3970 | m_fBkmksChanged = bf.upgraded(); | 3975 | m_fBkmksChanged = bf.upgraded(); |
3971 | if (pBkmklist == NULL) | 3976 | if (pBkmklist == NULL) |
3972 | { | 3977 | { |
3973 | reader->pBkmklist = pBkmklist = reader->getbkmklist(); | 3978 | reader->pBkmklist = pBkmklist = reader->getbkmklist(); |
3974 | } | 3979 | } |
3975 | if (pBkmklist != NULL) | 3980 | if (pBkmklist != NULL) |
3976 | pBkmklist->sort(); | 3981 | pBkmklist->sort(); |
3977 | } | 3982 | } |
3978 | 3983 | ||
3979 | void QTReaderApp::addbkmk() | 3984 | void QTReaderApp::addbkmk() |
3980 | { | 3985 | { |
3981 | m_nRegAction = cAddBkmk; | 3986 | m_nRegAction = cAddBkmk; |
3982 | regEdit->setText(reader->firstword()); | 3987 | regEdit->setText(reader->firstword()); |
3983 | do_regedit(); | 3988 | do_regedit(); |
3984 | } | 3989 | } |
3985 | 3990 | ||
3986 | void QTReaderApp::do_addbkmk(const QString& text) | 3991 | void QTReaderApp::do_addbkmk(const QString& text) |
3987 | { | 3992 | { |
3988 | if (text.isEmpty()) | 3993 | if (text.isEmpty()) |
3989 | { | 3994 | { |
3990 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nSelect add again", 1); | 3995 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nSelect add again", 1); |
3991 | } | 3996 | } |
3992 | else | 3997 | else |
3993 | { | 3998 | { |
3994 | if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>; | 3999 | if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>; |
3995 | #ifdef _UNICODE | 4000 | #ifdef _UNICODE |
3996 | CBuffer buff; | 4001 | CBuffer buff; |
3997 | int i = 0; | 4002 | int i = 0; |
3998 | for (i = 0; i < text.length(); i++) | 4003 | for (i = 0; i < text.length(); i++) |
3999 | { | 4004 | { |
4000 | buff[i] = text[i].unicode(); | 4005 | buff[i] = text[i].unicode(); |
4001 | } | 4006 | } |
4002 | buff[i] = 0; | 4007 | buff[i] = 0; |
4003 | pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate())); | 4008 | pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate())); |
4004 | #else | 4009 | #else |
4005 | pBkmklist->push_front(Bkmk((const tchar*)text, reader->pagelocate())); | 4010 | pBkmklist->push_front(Bkmk((const tchar*)text, reader->pagelocate())); |
4006 | #endif | 4011 | #endif |
4007 | m_fBkmksChanged = true; | 4012 | m_fBkmksChanged = true; |
4008 | pBkmklist->sort(); | 4013 | pBkmklist->sort(); |
4009 | reader->refresh(true); | 4014 | reader->refresh(true); |
4010 | } | 4015 | } |
4011 | } | 4016 | } |
4012 | 4017 | ||
4013 | void QTReaderApp::UpdateStatus() | 4018 | void QTReaderApp::UpdateStatus() |
4014 | { | 4019 | { |
4015 | QString status; | 4020 | QString status; |
4016 | for (int i = 0; i < m_statusstring.length(); i++) | 4021 | for (int i = 0; i < m_statusstring.length(); i++) |
4017 | { | 4022 | { |
4018 | if (m_statusstring[i].unicode() == '%') | 4023 | if (m_statusstring[i].unicode() == '%') |
4019 | { | 4024 | { |
4020 | i++; | 4025 | i++; |
4021 | if (i < m_statusstring.length()) | 4026 | if (i < m_statusstring.length()) |
4022 | { | 4027 | { |
4023 | switch (m_statusstring[i].unicode()) | 4028 | switch (m_statusstring[i].unicode()) |
4024 | { | 4029 | { |
4025 | case 'F': | 4030 | case 'F': |
4026 | { | 4031 | { |
4027 | unsigned long fs,ts; | 4032 | unsigned long fs,ts; |
4028 | reader->sizes(fs,ts); | 4033 | reader->sizes(fs,ts); |
4029 | status += filesize(ts); | 4034 | status += filesize(ts); |
4030 | } | 4035 | } |
4031 | break; | 4036 | break; |
4032 | case 'f': | 4037 | case 'f': |
4033 | { | 4038 | { |
4034 | status += filesize(reader->pagelocate()); | 4039 | status += filesize(reader->pagelocate()); |
4035 | } | 4040 | } |
4036 | break; | 4041 | break; |
4037 | case 'D': | 4042 | case 'D': |
4038 | { | 4043 | { |
4039 | status += filesize(reader->buffdoc.endSection()-reader->buffdoc.startSection()); | 4044 | status += filesize(reader->buffdoc.endSection()-reader->buffdoc.startSection()); |
4040 | } | 4045 | } |
4041 | break; | 4046 | break; |
4042 | case 'd': | 4047 | case 'd': |
4043 | { | 4048 | { |
4044 | status += filesize(reader->pagelocate()-reader->buffdoc.startSection()); | 4049 | status += filesize(reader->pagelocate()-reader->buffdoc.startSection()); |
4045 | } | 4050 | } |
4046 | break; | 4051 | break; |
4047 | case 'P': | 4052 | case 'P': |
4048 | { | 4053 | { |
4049 | unsigned long fs,ts; | 4054 | unsigned long fs,ts; |
4050 | reader->sizes(fs,ts); | 4055 | reader->sizes(fs,ts); |
4051 | status += percent(reader->pagelocate(),ts); | 4056 | status += percent(reader->pagelocate(),ts); |
4052 | } | 4057 | } |
4053 | break; | 4058 | break; |
4054 | case 'p': | 4059 | case 'p': |
4055 | { | 4060 | { |
4056 | status += percent(reader->pagelocate()-reader->buffdoc.startSection(),reader->buffdoc.endSection()-reader->buffdoc.startSection()); | 4061 | status += percent(reader->pagelocate()-reader->buffdoc.startSection(),reader->buffdoc.endSection()-reader->buffdoc.startSection()); |
4057 | } | 4062 | } |
4058 | break; | 4063 | break; |
4059 | case 'z': | 4064 | case 'z': |
4060 | { | 4065 | { |
4061 | // qDebug("case d"); | 4066 | // qDebug("case d"); |
4062 | status += QString().setNum(reader->m_fontControl.currentsize()*10); | 4067 | status += QString().setNum(reader->m_fontControl.currentsize()*10); |
4063 | } | 4068 | } |
4064 | break; | 4069 | break; |
4065 | default: | 4070 | default: |
4066 | status += m_statusstring[i]; | 4071 | status += m_statusstring[i]; |
4067 | } | 4072 | } |
4068 | } | 4073 | } |
4069 | } | 4074 | } |
4070 | else | 4075 | else |
4071 | { | 4076 | { |
4072 | status += m_statusstring[i]; | 4077 | status += m_statusstring[i]; |
4073 | } | 4078 | } |
4074 | } | 4079 | } |
4075 | m_prog->setText(status); | 4080 | m_prog->setText(status); |
4076 | } | 4081 | } |
4077 | 4082 | ||
4078 | void QTReaderApp::OnRedraw() | 4083 | void QTReaderApp::OnRedraw() |
4079 | { | 4084 | { |
4080 | if ((pBkmklist != NULL) && (m_bkmkAvail != NULL)) | 4085 | if ((pBkmklist != NULL) && (m_bkmkAvail != NULL)) |
4081 | { | 4086 | { |
4082 | bool found = findNextBookmark(reader->pagelocate()); | 4087 | bool found = findNextBookmark(reader->pagelocate()); |
4083 | m_bkmkAvail->setEnabled(found); | 4088 | m_bkmkAvail->setEnabled(found); |
4084 | } | 4089 | } |
4085 | if (m_scrollbar != NULL) | 4090 | if (m_scrollbar != NULL) |
4086 | { | 4091 | { |
4087 | //qDebug("OnRedraw:[%u, %u]", reader->buffdoc.startSection(), reader->buffdoc.endSection()); | 4092 | //qDebug("OnRedraw:[%u, %u]", reader->buffdoc.startSection(), reader->buffdoc.endSection()); |
4088 | scrollbar->setRange(reader->buffdoc.startSection(), reader->buffdoc.endSection()-1); | 4093 | scrollbar->setRange(reader->buffdoc.startSection(), reader->buffdoc.endSection()-1); |
4089 | scrollbar->setPageStep(reader->locate()-reader->pagelocate()); | 4094 | scrollbar->setPageStep(reader->locate()-reader->pagelocate()); |
4090 | scrollbar->setValue((reader->m_rotated) ? | 4095 | scrollbar->setValue((reader->m_rotated) ? |
4091 | (reader->buffdoc.endSection() - reader->locate()+reader->buffdoc.startSection()) : | 4096 | (reader->buffdoc.endSection() - reader->locate()+reader->buffdoc.startSection()) : |
4092 | reader->pagelocate()); | 4097 | reader->pagelocate()); |
4093 | } | 4098 | } |
4094 | if (m_prog->isVisible()) | 4099 | if (m_prog->isVisible()) |
4095 | { | 4100 | { |
4096 | // qDebug("updating status"); | 4101 | // qDebug("updating status"); |
4097 | UpdateStatus(); | 4102 | UpdateStatus(); |
4098 | // qDebug("updated status"); | 4103 | // qDebug("updated status"); |
4099 | } | 4104 | } |
4100 | } | 4105 | } |
4101 | 4106 | ||
4102 | void QTReaderApp::showAnnotation() | 4107 | void QTReaderApp::showAnnotation() |
4103 | { | 4108 | { |
4104 | m_annoWin->setName(toQString(m_anno->name())); | 4109 | m_annoWin->setName(toQString(m_anno->name())); |
4105 | m_annoWin->setAnno(toQString(m_anno->anno())); | 4110 | m_annoWin->setAnno(toQString(m_anno->anno())); |
4106 | m_annoWin->setColor(QColor(m_anno->red(), m_anno->green(), m_anno->blue())); | 4111 | m_annoWin->setColor(QColor(m_anno->red(), m_anno->green(), m_anno->blue())); |
4107 | m_annoIsEditing = false; | 4112 | m_annoIsEditing = false; |
4108 | #ifdef USEQPE | 4113 | #ifdef USEQPE |
4109 | Global::showInputMethod(); | 4114 | Global::showInputMethod(); |
4110 | #endif | 4115 | #endif |
4111 | editorStack->raiseWidget( m_annoWin ); | 4116 | editorStack->raiseWidget( m_annoWin ); |
4112 | hidetoolbars(); | 4117 | hidetoolbars(); |
4113 | m_annoWin->setFocus(); | 4118 | m_annoWin->setFocus(); |
4114 | } | 4119 | } |
4115 | 4120 | ||
4116 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, size_t posn2, const QString& line) | 4121 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, size_t posn2, const QString& line) |
4117 | { | 4122 | { |
4118 | //// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd); | 4123 | //// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd); |
4119 | 4124 | ||
4120 | if (m_doOutput && reader->checkoutput()) | 4125 | if (m_doOutput && reader->checkoutput()) |
4121 | { | 4126 | { |
4122 | reader->doOutput(wrd); | 4127 | reader->doOutput(wrd); |
4123 | } | 4128 | } |
4124 | if (m_doClipboard) | 4129 | if (m_doClipboard) |
4125 | { | 4130 | { |
4126 | QClipboard* cb = QApplication::clipboard(); | 4131 | QClipboard* cb = QApplication::clipboard(); |
4127 | cb->setText(wrd); | 4132 | cb->setText(wrd); |
4128 | #ifdef USEQPE | 4133 | #ifdef USEQPE |
4129 | if (wrd.length() > 10) | 4134 | if (wrd.length() > 10) |
4130 | { | 4135 | { |
4131 | Global::statusMessage(wrd.left(8) + ".."); | 4136 | Global::statusMessage(wrd.left(8) + ".."); |
4132 | } | 4137 | } |
4133 | else | 4138 | else |
4134 | { | 4139 | { |
4135 | Global::statusMessage(wrd); | 4140 | Global::statusMessage(wrd); |
4136 | } | 4141 | } |
4137 | #endif | 4142 | #endif |
4138 | } | 4143 | } |
4139 | if (m_doAnnotation) | 4144 | if (m_doAnnotation) |
4140 | { | 4145 | { |
4141 | //addAnno(wrd, "Need to be able to edit this", posn); | 4146 | //addAnno(wrd, "Need to be able to edit this", posn); |
4142 | m_annoWin->setName(line); | 4147 | m_annoWin->setName(line); |
4143 | m_annoWin->setAnno(""); | 4148 | m_annoWin->setAnno(""); |
4144 | m_annoWin->setPosn(posn); | 4149 | m_annoWin->setPosn(posn); |
4145 | m_annoWin->setPosn2(posn2); | 4150 | m_annoWin->setPosn2(posn2); |
4146 | m_annoIsEditing = true; | 4151 | m_annoIsEditing = true; |
4147 | #ifdef USEQPE | 4152 | #ifdef USEQPE |
4148 | Global::showInputMethod(); | 4153 | Global::showInputMethod(); |
4149 | #endif | 4154 | #endif |
4150 | editorStack->raiseWidget( m_annoWin ); | 4155 | editorStack->raiseWidget( m_annoWin ); |
4151 | hidetoolbars(); | 4156 | hidetoolbars(); |
4152 | } | 4157 | } |
4153 | #ifdef USEQPE | 4158 | #ifdef USEQPE |
4154 | if (m_doDictionary) | 4159 | if (m_doDictionary) |
4155 | { | 4160 | { |
4156 | if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty()) | 4161 | if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty()) |
4157 | { | 4162 | { |
4158 | QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8()); | 4163 | QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8()); |
4159 | e << wrd; | 4164 | e << wrd; |
4160 | } | 4165 | } |
4161 | } | 4166 | } |
4162 | #endif | 4167 | #endif |
4163 | } | 4168 | } |
4164 | 4169 | ||
4165 | void QTReaderApp::doAction(QKeyEvent* e) | 4170 | void QTReaderApp::doAction(QKeyEvent* e) |
4166 | { | 4171 | { |
4167 | QMap<orKey,int>::Iterator f = kmap.end(); | 4172 | QMap<orKey,int>::Iterator f = kmap.end(); |
4168 | 4173 | ||
4169 | if (reader->m_autoScroll) | 4174 | if (reader->m_autoScroll) |
4170 | { | 4175 | { |
4171 | f = kmap.find(orKey(e->state(), e->key(), true)); | 4176 | f = kmap.find(orKey(e->state(), e->key(), true)); |
4172 | } | 4177 | } |
4173 | if (f == kmap.end()) | 4178 | if (f == kmap.end()) |
4174 | { | 4179 | { |
4175 | f = kmap.find(orKey(e->state(), e->key(), false)); | 4180 | f = kmap.find(orKey(e->state(), e->key(), false)); |
4176 | } | 4181 | } |
4177 | 4182 | ||
4178 | if (f == kmap.end()) | 4183 | if (f == kmap.end()) |
4179 | { | 4184 | { |
4180 | qDebug("doaction (no action) : %d %d %d", e->key(), e->state(), f.data()); | 4185 | qDebug("doaction (no action) : %d %d %d", e->key(), e->state(), f.data()); |
4181 | e->ignore(); | 4186 | e->ignore(); |
4182 | } | 4187 | } |
4183 | else | 4188 | else |
4184 | { | 4189 | { |
4185 | qDebug("doaction (some action) : %d %d %d", e->key(), e->state(), f.data()); | 4190 | qDebug("doaction (some action) : %d %d %d", e->key(), e->state(), f.data()); |
4186 | ActionTypes a = (ActionTypes)f.data(); | 4191 | ActionTypes a = (ActionTypes)f.data(); |
4187 | e->accept(); | 4192 | e->accept(); |
4188 | //qDebug("Accepted"); | 4193 | //qDebug("Accepted"); |
4189 | switch (a) | 4194 | switch (a) |
4190 | { | 4195 | { |
4191 | case cesGotoLink: | 4196 | case cesGotoLink: |
4192 | { | 4197 | { |
4193 | reader->gotoLink(); | 4198 | reader->gotoLink(); |
4194 | } | 4199 | } |
4195 | break; | 4200 | break; |
4196 | case cesNextLink: | 4201 | case cesNextLink: |
4197 | { | 4202 | { |
4198 | reader->getNextLink(); | 4203 | reader->getNextLink(); |
4199 | } | 4204 | } |
4200 | break; | 4205 | break; |
4201 | case cesInvertColours: | 4206 | case cesInvertColours: |
4202 | m_inverse_action->setOn(!reader->bInverse); | 4207 | m_inverse_action->setOn(!reader->bInverse); |
4203 | break; | 4208 | break; |
4204 | case cesToggleBars: | 4209 | case cesToggleBars: |
4205 | m_hidebars = !m_hidebars; | 4210 | m_hidebars = !m_hidebars; |
4206 | if (m_hidebars) | 4211 | if (m_hidebars) |
4207 | { | 4212 | { |
4208 | #if defined(USEQPE) | 4213 | #if defined(USEQPE) |
4209 | menubar->hide(); | 4214 | menubar->hide(); |
4210 | #endif | 4215 | #endif |
4211 | if (fileBar != NULL) fileBar->hide(); | 4216 | if (fileBar != NULL) fileBar->hide(); |
4212 | if (viewBar != NULL) viewBar->hide(); | 4217 | if (viewBar != NULL) viewBar->hide(); |
4213 | if (navBar != NULL) navBar->hide(); | 4218 | if (navBar != NULL) navBar->hide(); |
4214 | if (markBar != NULL) markBar->hide(); | 4219 | if (markBar != NULL) markBar->hide(); |
4215 | mb->hide(); | 4220 | mb->hide(); |
4216 | } | 4221 | } |
4217 | else | 4222 | else |
4218 | { | 4223 | { |
4219 | #if defined(USEQPE) | 4224 | #if defined(USEQPE) |
4220 | menubar->show(); | 4225 | menubar->show(); |
4221 | #endif | 4226 | #endif |
4222 | if (fileBar != NULL) fileBar->show(); | 4227 | if (fileBar != NULL) fileBar->show(); |
4223 | if (viewBar != NULL) viewBar->show(); | 4228 | if (viewBar != NULL) viewBar->show(); |
4224 | if (navBar != NULL) navBar->show(); | 4229 | if (navBar != NULL) navBar->show(); |
4225 | if (markBar != NULL) markBar->show(); | 4230 | if (markBar != NULL) markBar->show(); |
4226 | mb->show(); | 4231 | mb->show(); |
4227 | } | 4232 | } |
4228 | break; | 4233 | break; |
4229 | case cesToggleScrollBar: | 4234 | case cesToggleScrollBar: |
4230 | if (m_scrollbar != NULL) | 4235 | if (m_scrollbar != NULL) |
4231 | { | 4236 | { |
4232 | if (m_scrollbar->isHidden()) | 4237 | if (m_scrollbar->isHidden()) |
4233 | { | 4238 | { |
4234 | m_scrollishidden = false; | 4239 | m_scrollishidden = false; |
4235 | m_scrollbar->show(); | 4240 | m_scrollbar->show(); |
4236 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; | 4241 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; |
4237 | } | 4242 | } |
4238 | else | 4243 | else |
4239 | { | 4244 | { |
4240 | m_scrollishidden = true; | 4245 | m_scrollishidden = true; |
4241 | m_scrollbar->hide(); | 4246 | m_scrollbar->hide(); |
4242 | reader->m_scrollpos = m_localscroll; | 4247 | reader->m_scrollpos = m_localscroll; |
4243 | } | 4248 | } |
4244 | } | 4249 | } |
4245 | break; | 4250 | break; |
4246 | case cesToggleStatusBar: | 4251 | case cesToggleStatusBar: |
4247 | if (m_prog != NULL) | 4252 | if (m_prog != NULL) |
4248 | { | 4253 | { |
4249 | if (m_prog->isHidden()) | 4254 | if (m_prog->isHidden()) |
4250 | { | 4255 | { |
4251 | m_statusishidden = false; | 4256 | m_statusishidden = false; |
4252 | m_prog->show(); | 4257 | m_prog->show(); |
4253 | } | 4258 | } |
4254 | else | 4259 | else |
4255 | { | 4260 | { |
4256 | m_statusishidden = true; | 4261 | m_statusishidden = true; |
4257 | m_prog->hide(); | 4262 | m_prog->hide(); |
4258 | } | 4263 | } |
4259 | } | 4264 | } |
4260 | break; | 4265 | break; |
4261 | case cesOpenFile: | 4266 | case cesOpenFile: |
4262 | { | 4267 | { |
4263 | qDebug("Open file"); | 4268 | qDebug("Open file"); |
4264 | fileOpen(); | 4269 | fileOpen(); |
4265 | } | 4270 | } |
4266 | break; | 4271 | break; |
4267 | case cesAutoScroll: | 4272 | case cesAutoScroll: |
4268 | { | 4273 | { |
4269 | reader->setautoscroll(!reader->m_autoScroll); | 4274 | reader->setautoscroll(!reader->m_autoScroll); |
4270 | setScrollState(reader->m_autoScroll); | 4275 | setScrollState(reader->m_autoScroll); |
4271 | } | 4276 | } |
4272 | break; | 4277 | break; |
4273 | case cesActionMark: | 4278 | case cesActionMark: |
4274 | { | 4279 | { |
4275 | addbkmk(); | 4280 | addbkmk(); |
4276 | } | 4281 | } |
4277 | break; | 4282 | break; |
4278 | case cesFullScreen: | 4283 | case cesFullScreen: |
4279 | { | 4284 | { |
4280 | m_actFullscreen->setOn(!m_fullscreen); | 4285 | m_actFullscreen->setOn(!m_fullscreen); |
4281 | } | 4286 | } |
4282 | break; | 4287 | break; |
4283 | case cesRotate: | 4288 | case cesRotate: |
4284 | { | 4289 | { |
4285 | m_rotate_action->setOn(!reader->m_rotated); | 4290 | m_rotate_action->setOn(!reader->m_rotated); |
4286 | } | 4291 | } |
4287 | break; | 4292 | break; |
4288 | case cesActionAnno: | 4293 | case cesActionAnno: |
4289 | { | 4294 | { |
4290 | addanno(); | 4295 | addanno(); |
4291 | } | 4296 | } |
4292 | break; | 4297 | break; |
4293 | case cesZoomIn: | 4298 | case cesZoomIn: |
4294 | zoomin(); | 4299 | zoomin(); |
4295 | break; | 4300 | break; |
4296 | case cesZoomOut: | 4301 | case cesZoomOut: |
4297 | zoomout(); | 4302 | zoomout(); |
4298 | break; | 4303 | break; |
4299 | case cesBack: | 4304 | case cesBack: |
4300 | reader->goBack(); | 4305 | reader->goBack(); |
4301 | break; | 4306 | break; |
4302 | case cesForward: | 4307 | case cesForward: |
4303 | reader->goForward(); | 4308 | reader->goForward(); |
4304 | break; | 4309 | break; |
4305 | case cesHome: | 4310 | case cesHome: |
4306 | reader->goHome(); | 4311 | reader->goHome(); |
4307 | break; | 4312 | break; |
4308 | case cesPageUp: | 4313 | case cesPageUp: |
4309 | reader->dopageup(); | 4314 | reader->dopageup(); |
4310 | /* | 4315 | /* |
4311 | ftime(&m_lastkeytime); | 4316 | ftime(&m_lastkeytime); |
4312 | m_fndelay = m_debounce; | 4317 | m_fndelay = m_debounce; |
4313 | // | 4318 | // |
4314 | { | 4319 | { |
4315 | timeb now; | 4320 | timeb now; |
4316 | ftime(&now); | 4321 | ftime(&now); |
4317 | m_fndelay = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm+100; | 4322 | m_fndelay = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm+100; |
4318 | } | 4323 | } |
4319 | */ | 4324 | */ |
4320 | break; | 4325 | break; |
4321 | case cesPageDown: | 4326 | case cesPageDown: |
4322 | reader->dopagedn(); | 4327 | reader->dopagedn(); |
4323 | /* | 4328 | /* |
4324 | ftime(&m_lastkeytime); | 4329 | ftime(&m_lastkeytime); |
4325 | m_fndelay = m_debounce; | 4330 | m_fndelay = m_debounce; |
4326 | // | 4331 | // |
4327 | if (m_debounce != 0) | 4332 | if (m_debounce != 0) |
4328 | { | 4333 | { |
4329 | timeb now; | 4334 | timeb now; |
4330 | ftime(&now); | 4335 | ftime(&now); |
4331 | m_fndelay = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm+10; | 4336 | m_fndelay = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm+10; |
4332 | } | 4337 | } |
4333 | */ | 4338 | */ |
4334 | break; | 4339 | break; |
4335 | case cesLineUp: | 4340 | case cesLineUp: |
4336 | reader->lineUp(); | 4341 | reader->lineUp(); |
4337 | break; | 4342 | break; |
4338 | case cesLineDown: | 4343 | case cesLineDown: |
4339 | reader->lineDown(); | 4344 | reader->lineDown(); |
4340 | break; | 4345 | break; |
4341 | case cesStartDoc: | 4346 | case cesStartDoc: |
4342 | gotoStart(); | 4347 | gotoStart(); |
4343 | break; | 4348 | break; |
4344 | case cesEndDoc: | 4349 | case cesEndDoc: |
4345 | gotoEnd(); | 4350 | gotoEnd(); |
4346 | break; | 4351 | break; |
4347 | case cesScrollMore: | 4352 | case cesScrollMore: |
4348 | reader->increaseScroll(); | 4353 | reader->increaseScroll(); |
4349 | break; | 4354 | break; |
4350 | case cesScrollLess: | 4355 | case cesScrollLess: |
4351 | reader->reduceScroll(); | 4356 | reader->reduceScroll(); |
4352 | break; | 4357 | break; |
4353 | default: | 4358 | default: |
4354 | qDebug("Unknown ActionType:%u", a); | 4359 | qDebug("Unknown ActionType:%u", a); |
4355 | break; | 4360 | break; |
4356 | } | 4361 | } |
4357 | } | 4362 | } |
4358 | } | 4363 | } |
4359 | 4364 | ||
4360 | void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); } | 4365 | void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); } |
4361 | void QTReaderApp::restoreFocus() { reader->setFocus(); } | 4366 | void QTReaderApp::restoreFocus() { reader->setFocus(); } |
4362 | 4367 | ||
4363 | void QTReaderApp::SaveConfig() | 4368 | void QTReaderApp::SaveConfig() |
4364 | { | 4369 | { |
4365 | m_nRegAction = cSetConfigName; | 4370 | m_nRegAction = cSetConfigName; |
4366 | regEdit->setText(reader->m_string); | 4371 | regEdit->setText(reader->m_string); |
4367 | do_regedit(); | 4372 | do_regedit(); |
4368 | } | 4373 | } |
4369 | 4374 | ||
4370 | void QTReaderApp::do_saveconfig(const QString& _txt, bool full) | 4375 | void QTReaderApp::do_saveconfig(const QString& _txt, bool full) |
4371 | { | 4376 | { |
4372 | // qDebug("do_saveconfig:%s", (const char*)_txt); | 4377 | // qDebug("do_saveconfig:%s", (const char*)_txt); |
4373 | #ifdef USEQPE | 4378 | #ifdef USEQPE |
4374 | QString configname; | 4379 | QString configname; |
4375 | Config::Domain dom; | 4380 | Config::Domain dom; |
4376 | 4381 | ||
4377 | if (full) | 4382 | if (full) |
4378 | { | 4383 | { |
4379 | configname = _txt; | 4384 | configname = _txt; |
4380 | dom = Config::User; | 4385 | dom = Config::User; |
4381 | } | 4386 | } |
4382 | else | 4387 | else |
4383 | { | 4388 | { |
4384 | configname = Global::applicationFileName(APPDIR "/configs", _txt); | 4389 | configname = Global::applicationFileName(APPDIR "/configs", _txt); |
4385 | dom = Config::File; | 4390 | dom = Config::File; |
4386 | } | 4391 | } |
4387 | 4392 | ||
4388 | Config config(configname, dom); | 4393 | Config config(configname, dom); |
4389 | config.setGroup( "View" ); | 4394 | config.setGroup( "View" ); |
4390 | 4395 | ||
4391 | #else | 4396 | #else |
4392 | QFileInfo fi; | 4397 | QFileInfo fi; |
4393 | if (full) | 4398 | if (full) |
4394 | { | 4399 | { |
4395 | // qDebug("full:%s", (const char*)_txt); | 4400 | // qDebug("full:%s", (const char*)_txt); |
4396 | QDir d = QDir::home(); // "/" | 4401 | QDir d = QDir::home(); // "/" |
4397 | if ( !d.cd(_txt) ) | 4402 | if ( !d.cd(_txt) ) |
4398 | { // "/tmp" | 4403 | { // "/tmp" |
4399 | qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt ); | 4404 | qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt ); |
4400 | d = QDir::home(); | 4405 | d = QDir::home(); |
4401 | d.mkdir(_txt); | 4406 | d.mkdir(_txt); |
4402 | d.cd(_txt); | 4407 | d.cd(_txt); |
4403 | } | 4408 | } |
4404 | fi.setFile(d, INIFILE); | 4409 | fi.setFile(d, INIFILE); |
4405 | } | 4410 | } |
4406 | else | 4411 | else |
4407 | { | 4412 | { |
4408 | QDir d = QDir::home(); // "/" | 4413 | QDir d = QDir::home(); // "/" |
4409 | if ( !d.cd(APPDIR) ) | 4414 | if ( !d.cd(APPDIR) ) |
4410 | { // "/tmp" | 4415 | { // "/tmp" |
4411 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 4416 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); |
4412 | d = QDir::home(); | 4417 | d = QDir::home(); |
4413 | d.mkdir(APPDIR); | 4418 | d.mkdir(APPDIR); |
4414 | d.cd(APPDIR); | 4419 | d.cd(APPDIR); |
4415 | } | 4420 | } |
4416 | if ( !d.cd("configs") ) | 4421 | if ( !d.cd("configs") ) |
4417 | { // "/tmp" | 4422 | { // "/tmp" |
4418 | qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" ); | 4423 | qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" ); |
4419 | d = QDir::home(); | 4424 | d = QDir::home(); |
4420 | d.cd(APPDIR); | 4425 | d.cd(APPDIR); |
4421 | d.mkdir("configs"); | 4426 | d.mkdir("configs"); |
4422 | d.cd("configs"); | 4427 | d.cd("configs"); |
4423 | } | 4428 | } |
4424 | fi.setFile(d, _txt); | 4429 | fi.setFile(d, _txt); |
4425 | } | 4430 | } |
4426 | //qDebug("Path:%s", (const char*)fi.absFilePath()); | 4431 | //qDebug("Path:%s", (const char*)fi.absFilePath()); |
4427 | Config config(fi.absFilePath()); | 4432 | Config config(fi.absFilePath()); |
4428 | #endif | 4433 | #endif |
4429 | 4434 | ||
4430 | 4435 | ||
4431 | config.writeEntry( "StripCr", reader->bstripcr ); | 4436 | config.writeEntry( "StripCr", reader->bstripcr ); |
4432 | config.writeEntry( "NoInlineTables", reader->bNoInlineTables ); | 4437 | config.writeEntry( "NoInlineTables", reader->bNoInlineTables ); |
4433 | config.writeEntry( "AutoFmt", reader->bautofmt ); | 4438 | config.writeEntry( "AutoFmt", reader->bautofmt ); |
4434 | config.writeEntry( "TextFmt", reader->btextfmt ); | 4439 | config.writeEntry( "TextFmt", reader->btextfmt ); |
4435 | config.writeEntry( "StripHtml", reader->bstriphtml ); | 4440 | config.writeEntry( "StripHtml", reader->bstriphtml ); |
4436 | config.writeEntry( "Dehyphen", reader->bdehyphen ); | 4441 | config.writeEntry( "Dehyphen", reader->bdehyphen ); |
4437 | config.writeEntry( "Depluck", reader->bdepluck ); | 4442 | config.writeEntry( "Depluck", reader->bdepluck ); |
4438 | config.writeEntry( "Dejpluck", reader->bdejpluck ); | 4443 | config.writeEntry( "Dejpluck", reader->bdejpluck ); |
4439 | config.writeEntry( "OneSpace", reader->bonespace ); | 4444 | config.writeEntry( "OneSpace", reader->bonespace ); |
4440 | config.writeEntry( "Unindent", reader->bunindent ); | 4445 | config.writeEntry( "Unindent", reader->bunindent ); |
4441 | config.writeEntry( "Repara", reader->brepara ); | 4446 | config.writeEntry( "Repara", reader->brepara ); |
4442 | config.writeEntry( "ReparaString", reader->m_reparastring); | 4447 | config.writeEntry( "ReparaString", reader->m_reparastring); |
4443 | config.writeEntry( "BackgroundType" , (int)m_bgtype ); | 4448 | config.writeEntry( "BackgroundType" , (int)m_bgtype ); |
4444 | config.writeEntry( "Theme", m_themename ); | 4449 | config.writeEntry( "Theme", m_themename ); |
4445 | config.writeEntry( "DoubleSpace", reader->bdblspce ); | 4450 | config.writeEntry( "DoubleSpace", reader->bdblspce ); |
4446 | config.writeEntry( "Indent", reader->bindenter ); | 4451 | config.writeEntry( "Indent", reader->bindenter ); |
4447 | config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) ); | 4452 | config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) ); |
4448 | config.writeEntry( "ScrollDelay", reader->m_delay); | 4453 | config.writeEntry( "ScrollDelay", reader->m_delay); |
4449 | config.writeEntry( "ScrollStep", reader->m_scrollstep); | 4454 | config.writeEntry( "ScrollStep", reader->m_scrollstep); |
4450 | config.writeEntry( "ScrollType", reader->m_scrolltype ); | 4455 | config.writeEntry( "ScrollType", reader->m_scrolltype ); |
4451 | if (full) | 4456 | if (full) |
4452 | { | 4457 | { |
4453 | config.writeEntry("Debounce", m_debounce); | 4458 | config.writeEntry("Debounce", m_debounce); |
4454 | config.writeEntry("FloatDialogs", m_bFloatingDialog); | 4459 | config.writeEntry("FloatDialogs", m_bFloatingDialog); |
4455 | reader->m_lastposn = reader->pagelocate(); | 4460 | reader->m_lastposn = reader->pagelocate(); |
4456 | config.writeEntry( "LastFile", reader->m_lastfile ); | 4461 | config.writeEntry( "LastFile", reader->m_lastfile ); |
4457 | config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); | 4462 | config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); |
4458 | config.writeEntry( "OutputCodec", reader->m_outputName); | 4463 | config.writeEntry( "OutputCodec", reader->m_outputName); |
4459 | } | 4464 | } |
4460 | config.writeEntry( "PageMode", reader->m_bpagemode ); | 4465 | config.writeEntry( "PageMode", reader->m_bpagemode ); |
4461 | config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); | 4466 | config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); |
4462 | config.writeEntry( "SwapMouse", reader->m_swapmouse); | 4467 | config.writeEntry( "SwapMouse", reader->m_swapmouse); |
4463 | config.writeEntry( "IsRotated", reader->m_rotated ); | 4468 | config.writeEntry( "IsRotated", reader->m_rotated ); |
4464 | config.writeEntry("StatusContent", m_statusstring); | 4469 | config.writeEntry("StatusContent", m_statusstring); |
4465 | config.writeEntry("StatusHidden", m_statusishidden); | 4470 | config.writeEntry("StatusHidden", m_statusishidden); |
4466 | config.writeEntry( "Background", m_background ); | 4471 | config.writeEntry( "Background", m_background ); |
4467 | config.writeEntry( "Foreground", m_foreground ); | 4472 | config.writeEntry( "Foreground", m_foreground ); |
4468 | config.writeEntry( "ScrollColour", m_scrollcolor ); | 4473 | config.writeEntry( "ScrollColour", m_scrollcolor ); |
4469 | config.writeEntry( "ScrollBarColour", m_scrollbarcolor ); | 4474 | config.writeEntry( "ScrollBarColour", m_scrollbarcolor ); |
4470 | config.writeEntry( "Hyphenate", reader->hyphenate ); | 4475 | config.writeEntry( "Hyphenate", reader->hyphenate ); |
4471 | // config.writeEntry( "CustomHyphen", reader->buffdoc.getCustomHyphen() ); | 4476 | // config.writeEntry( "CustomHyphen", reader->buffdoc.getCustomHyphen() ); |
4472 | config.writeEntry( "Fontname", reader->m_fontname ); | 4477 | config.writeEntry( "Fontname", reader->m_fontname ); |
4473 | config.writeEntry( "Encoding", reader->m_encd ); | 4478 | config.writeEntry( "Encoding", reader->m_encd ); |
4474 | config.writeEntry( "CharSpacing", reader->m_charpc ); | 4479 | config.writeEntry( "CharSpacing", reader->m_charpc ); |
4475 | config.writeEntry( "Overlap", (int)(reader->m_overlap) ); | 4480 | config.writeEntry( "Overlap", (int)(reader->m_overlap) ); |
4476 | config.writeEntry( "Top Margin", (int)reader->m_abstopmargin ); | 4481 | config.writeEntry( "Top Margin", (int)reader->m_abstopmargin ); |
4477 | config.writeEntry( "Bottom Margin", (int)reader->m_absbottommargin ); | 4482 | config.writeEntry( "Bottom Margin", (int)reader->m_absbottommargin ); |
4478 | config.writeEntry( "Left Margin", (int)reader->m_absleft_border ); | 4483 | config.writeEntry( "Left Margin", (int)reader->m_absleft_border ); |
4479 | config.writeEntry( "Right Margin", (int)reader->m_absright_border ); | 4484 | config.writeEntry( "Right Margin", (int)reader->m_absright_border ); |
4480 | config.writeEntry( "TargetApp", m_targetapp ); | 4485 | config.writeEntry( "TargetApp", m_targetapp ); |
4481 | config.writeEntry( "TargetMsg", m_targetmsg ); | 4486 | config.writeEntry( "TargetMsg", m_targetmsg ); |
4482 | #ifdef _SCROLLPIPE | 4487 | #ifdef _SCROLLPIPE |
4483 | config.writeEntry( "PipeTarget", reader->m_pipetarget ); | 4488 | config.writeEntry( "PipeTarget", reader->m_pipetarget ); |
4484 | config.writeEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); | 4489 | config.writeEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); |
4485 | #endif | 4490 | #endif |
4486 | config.writeEntry( "TwoTouch", m_twoTouch ); | 4491 | config.writeEntry( "TwoTouch", m_twoTouch ); |
4487 | config.writeEntry( "Annotation", m_doAnnotation); | 4492 | config.writeEntry( "Annotation", m_doAnnotation); |
4488 | config.writeEntry( "Dictionary", m_doDictionary); | 4493 | config.writeEntry( "Dictionary", m_doDictionary); |
4489 | config.writeEntry( "Clipboard", m_doClipboard); | 4494 | config.writeEntry( "Clipboard", m_doClipboard); |
4490 | config.writeEntry( "OutputTgt", m_doOutput); | 4495 | config.writeEntry( "OutputTgt", m_doOutput); |
4491 | /* | 4496 | /* |
4492 | config.writeEntry( "SpaceTarget", m_spaceTarget); | 4497 | config.writeEntry( "SpaceTarget", m_spaceTarget); |
4493 | config.writeEntry( "EscapeTarget", m_escapeTarget); | 4498 | config.writeEntry( "EscapeTarget", m_escapeTarget); |
4494 | config.writeEntry( "ReturnTarget", m_returnTarget); | 4499 | config.writeEntry( "ReturnTarget", m_returnTarget); |
4495 | config.writeEntry( "LeftTarget", m_leftTarget); | 4500 | config.writeEntry( "LeftTarget", m_leftTarget); |
4496 | config.writeEntry( "RightTarget", m_rightTarget); | 4501 | config.writeEntry( "RightTarget", m_rightTarget); |
4497 | config.writeEntry( "UpTarget", m_upTarget); | 4502 | config.writeEntry( "UpTarget", m_upTarget); |
4498 | config.writeEntry( "DownTarget", m_downTarget); | 4503 | config.writeEntry( "DownTarget", m_downTarget); |
4499 | config.writeEntry("LeftScroll", m_leftScroll); | 4504 | config.writeEntry("LeftScroll", m_leftScroll); |
4500 | config.writeEntry("RightScroll", m_rightScroll); | 4505 | config.writeEntry("RightScroll", m_rightScroll); |
4501 | config.writeEntry("UpScroll", m_upScroll); | 4506 | config.writeEntry("UpScroll", m_upScroll); |
4502 | config.writeEntry("DownScroll", m_downScroll); | 4507 | config.writeEntry("DownScroll", m_downScroll); |
4503 | */ | 4508 | */ |
4504 | config.writeEntry( "Repalm", reader->brepalm ); | 4509 | config.writeEntry( "Repalm", reader->brepalm ); |
4505 | config.writeEntry( "UnderlineLink", reader->bunderlineLink ); | 4510 | config.writeEntry( "UnderlineLink", reader->bunderlineLink ); |
4506 | config.writeEntry( "HideScrollBar", m_scrollishidden ); | 4511 | config.writeEntry( "HideScrollBar", m_scrollishidden ); |
4507 | config.writeEntry( "HideToolBar", m_hidebars ); | 4512 | config.writeEntry( "HideToolBar", m_hidebars ); |
4508 | config.writeEntry( "Kern", reader->bkern ); | 4513 | config.writeEntry( "Kern", reader->bkern ); |
4509 | config.writeEntry( "Remap", reader->bremap ); | 4514 | config.writeEntry( "Remap", reader->bremap ); |
4510 | config.writeEntry( "Peanut", reader->bpeanut ); | 4515 | config.writeEntry( "Peanut", reader->bpeanut ); |
4511 | config.writeEntry( "MakeBold", reader->bmakebold ); | 4516 | config.writeEntry( "MakeBold", reader->bmakebold ); |
4512 | config.writeEntry( "Continuous", reader->m_continuousDocument ); | 4517 | config.writeEntry( "Continuous", reader->m_continuousDocument ); |
4513 | config.writeEntry( "DoubleBuffer", reader->m_doubleBuffered); | 4518 | config.writeEntry( "DoubleBuffer", reader->m_doubleBuffered); |
4514 | config.writeEntry( "FullJust", reader->bfulljust ); | 4519 | config.writeEntry( "FullJust", reader->bfulljust ); |
4515 | // config.writeEntry( "Negative", reader->bNegative ); | 4520 | // config.writeEntry( "Negative", reader->bNegative ); |
4516 | config.writeEntry( "Inverse", reader->bInverse ); | 4521 | config.writeEntry( "Inverse", reader->bInverse ); |
4517 | config.writeEntry( "FixGraphics", reader->m_fontControl.FixGraphics()); | 4522 | config.writeEntry( "FixGraphics", reader->m_fontControl.FixGraphics()); |
4518 | config.writeEntry( "ExtraSpace", reader->getextraspace() ); | 4523 | config.writeEntry( "ExtraSpace", reader->getextraspace() ); |
4519 | config.writeEntry( "ExtraLead", reader->getlead() ); | 4524 | config.writeEntry( "ExtraLead", reader->getlead() ); |
4520 | config.writeEntry( "Basesize", (int)reader->getBaseSize()); | 4525 | config.writeEntry( "Basesize", (int)reader->getBaseSize()); |
4521 | config.writeEntry( "RequestorFontChange", m_propogatefontchange); | 4526 | config.writeEntry( "RequestorFontChange", m_propogatefontchange); |
4522 | #ifdef USEQPE | 4527 | #ifdef USEQPE |
4523 | config.writeEntry( "GrabKeyboard", m_grabkeyboard ); | 4528 | config.writeEntry( "GrabKeyboard", m_grabkeyboard ); |
4524 | #endif | 4529 | #endif |
4525 | if (full) | 4530 | if (full) |
4526 | { | 4531 | { |
4527 | config.setGroup( "Toolbar" ); | 4532 | config.setGroup( "Toolbar" ); |
4528 | config.writeEntry("QTScrollBar", m_qtscroll); | 4533 | config.writeEntry("QTScrollBar", m_qtscroll); |
4529 | config.writeEntry("LocalScrollBar", m_localscroll); | 4534 | config.writeEntry("LocalScrollBar", m_localscroll); |
4530 | config.writeEntry("Movable", m_tbmovesave); | 4535 | config.writeEntry("Movable", m_tbmovesave); |
4531 | config.writeEntry("Policy", m_tbpolsave); | 4536 | config.writeEntry("Policy", m_tbpolsave); |
4532 | config.writeEntry("Position", m_tbposition); | 4537 | config.writeEntry("Position", m_tbposition); |
4533 | #ifndef USEQPE | 4538 | #ifndef USEQPE |
4534 | if (!isMaximized() && !isMinimized()) | 4539 | if (!isMaximized() && !isMinimized()) |
4535 | { | 4540 | { |
4536 | config.setGroup( "Geometry" ); | 4541 | config.setGroup( "Geometry" ); |
4537 | config.writeEntry( "x", x() ); | 4542 | config.writeEntry( "x", x() ); |
4538 | config.writeEntry( "y", y() ); | 4543 | config.writeEntry( "y", y() ); |
4539 | config.writeEntry( "width", width() ); | 4544 | config.writeEntry( "width", width() ); |
4540 | config.writeEntry( "height", height() ); | 4545 | config.writeEntry( "height", height() ); |
4541 | } | 4546 | } |
4542 | #endif | 4547 | #endif |
4543 | } | 4548 | } |
4544 | } | 4549 | } |
4545 | 4550 | ||
4546 | #ifdef _SCROLLPIPE | 4551 | #ifdef _SCROLLPIPE |
4547 | void QTReaderApp::setpipetarget() | 4552 | void QTReaderApp::setpipetarget() |
4548 | { | 4553 | { |
4549 | m_nRegAction = cSetPipeTarget; | 4554 | m_nRegAction = cSetPipeTarget; |
4550 | QString text = (reader->m_pipetarget.isEmpty()) ? QString("") : reader->m_pipetarget; | 4555 | QString text = (reader->m_pipetarget.isEmpty()) ? QString("") : reader->m_pipetarget; |
4551 | regEdit->setText(text); | 4556 | regEdit->setText(text); |
4552 | do_regedit(); | 4557 | do_regedit(); |
4553 | } | 4558 | } |
4554 | 4559 | ||
4555 | void QTReaderApp::do_setpipetarget(const QString& _txt) | 4560 | void QTReaderApp::do_setpipetarget(const QString& _txt) |
4556 | { | 4561 | { |
4557 | reader->m_pipetarget = _txt; | 4562 | reader->m_pipetarget = _txt; |
4558 | } | 4563 | } |
4559 | 4564 | ||
4560 | void QTReaderApp::setpause(bool sfs) | 4565 | void QTReaderApp::setpause(bool sfs) |
4561 | { | 4566 | { |
4562 | reader->m_pauseAfterEachPara = sfs; | 4567 | reader->m_pauseAfterEachPara = sfs; |
4563 | } | 4568 | } |
4564 | #endif | 4569 | #endif |
4565 | 4570 | ||
4566 | void QTReaderApp::monospace(bool _b) | 4571 | void QTReaderApp::monospace(bool _b) |
4567 | { | 4572 | { |
4568 | reader->setmono(_b); | 4573 | reader->setmono(_b); |
4569 | } | 4574 | } |
4570 | 4575 | ||
4571 | bool QTReaderApp::readconfig(const QString& dirname, const QString& _txt, bool full=false) | 4576 | bool QTReaderApp::readconfig(const QString& dirname, const QString& _txt, bool full=false) |
4572 | { | 4577 | { |
4573 | #ifdef USEQPE | 4578 | #ifdef USEQPE |
4574 | QString configname; | 4579 | QString configname; |
4575 | Config::Domain dom; | 4580 | Config::Domain dom; |
4576 | 4581 | ||
4577 | if (full) | 4582 | if (full) |
4578 | { | 4583 | { |
4579 | configname = _txt; | 4584 | configname = _txt; |
4580 | dom = Config::User; | 4585 | dom = Config::User; |
4581 | } | 4586 | } |
4582 | else | 4587 | else |
4583 | { | 4588 | { |
4584 | configname = Global::applicationFileName(dirname, _txt); | 4589 | configname = Global::applicationFileName(dirname, _txt); |
4585 | QFileInfo fm(configname); | 4590 | QFileInfo fm(configname); |
4586 | if ( !fm.exists() ) return false; | 4591 | if ( !fm.exists() ) return false; |
4587 | dom = Config::File; | 4592 | dom = Config::File; |
4588 | } | 4593 | } |
4589 | 4594 | ||
4590 | Config config(configname, dom); | 4595 | Config config(configname, dom); |
4591 | config.setGroup( "View" ); | 4596 | config.setGroup( "View" ); |
4592 | 4597 | ||
4593 | #else | 4598 | #else |
4594 | QString fullname; | 4599 | QString fullname; |
4595 | if (full) | 4600 | if (full) |
4596 | { | 4601 | { |
4597 | fullname = QDir::homeDirPath() + "/" + _txt + "/" + INIFILE; | 4602 | fullname = QDir::homeDirPath() + "/" + _txt + "/" + INIFILE; |
4598 | } | 4603 | } |
4599 | else | 4604 | else |
4600 | { | 4605 | { |
4601 | fullname = QDir::homeDirPath() + "/" + dirname + "/" + _txt; | 4606 | fullname = QDir::homeDirPath() + "/" + dirname + "/" + _txt; |
4602 | } | 4607 | } |
4603 | if (!QFile::exists(fullname)) return false; | 4608 | if (!QFile::exists(fullname)) return false; |
4604 | 4609 | ||
4605 | Config config(fullname); | 4610 | Config config(fullname); |
4606 | #endif | 4611 | #endif |
4607 | if (full) | 4612 | if (full) |
4608 | { | 4613 | { |
4609 | config.setGroup("Toolbar"); | 4614 | config.setGroup("Toolbar"); |
4610 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", m_tbmovesave); | 4615 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", m_tbmovesave); |
4611 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", m_tbpolsave); | 4616 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", m_tbpolsave); |
4612 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", m_tbposition); | 4617 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", m_tbposition); |
4613 | } | 4618 | } |
4614 | config.setGroup( "View" ); | 4619 | config.setGroup( "View" ); |
4615 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", m_bFloatingDialog); | 4620 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", m_bFloatingDialog); |
4616 | reader->bstripcr = config.readBoolEntry( "StripCr", reader->bstripcr ); | 4621 | reader->bstripcr = config.readBoolEntry( "StripCr", reader->bstripcr ); |
4617 | reader->bNoInlineTables = config.readBoolEntry( "NoInlineTables", reader->bNoInlineTables ); | 4622 | reader->bNoInlineTables = config.readBoolEntry( "NoInlineTables", reader->bNoInlineTables ); |
4618 | reader->bfulljust = config.readBoolEntry( "FullJust", reader->bfulljust ); | 4623 | reader->bfulljust = config.readBoolEntry( "FullJust", reader->bfulljust ); |
4619 | reader->bInverse = config.readBoolEntry( "Inverse", reader->bInverse ); | 4624 | reader->bInverse = config.readBoolEntry( "Inverse", reader->bInverse ); |
4620 | // reader->bNegative = config.readBoolEntry( "Negative", false ); | 4625 | // reader->bNegative = config.readBoolEntry( "Negative", false ); |
4621 | reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", reader->m_fontControl.FixGraphics() )); | 4626 | reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", reader->m_fontControl.FixGraphics() )); |
4622 | reader->setextraspace(config.readNumEntry( "ExtraSpace", reader->getextraspace() )); | 4627 | reader->setextraspace(config.readNumEntry( "ExtraSpace", reader->getextraspace() )); |
4623 | reader->setlead(config.readNumEntry( "ExtraLead", reader->getlead() )); | 4628 | reader->setlead(config.readNumEntry( "ExtraLead", reader->getlead() )); |
4624 | reader->btextfmt = config.readBoolEntry( "TextFmt", reader->btextfmt ); | 4629 | reader->btextfmt = config.readBoolEntry( "TextFmt", reader->btextfmt ); |
4625 | reader->bautofmt = config.readBoolEntry( "AutoFmt", reader->bautofmt ); | 4630 | reader->bautofmt = config.readBoolEntry( "AutoFmt", reader->bautofmt ); |
4626 | reader->bstriphtml = config.readBoolEntry( "StripHtml", reader->bstriphtml ); | 4631 | reader->bstriphtml = config.readBoolEntry( "StripHtml", reader->bstriphtml ); |
4627 | reader->bpeanut = config.readBoolEntry( "Peanut", reader->bpeanut ); | 4632 | reader->bpeanut = config.readBoolEntry( "Peanut", reader->bpeanut ); |
4628 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", reader->bdehyphen ); | 4633 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", reader->bdehyphen ); |
4629 | reader->bdepluck = config.readBoolEntry( "Depluck", reader->bdepluck ); | 4634 | reader->bdepluck = config.readBoolEntry( "Depluck", reader->bdepluck ); |
4630 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", reader->bdejpluck ); | 4635 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", reader->bdejpluck ); |
4631 | reader->bonespace = config.readBoolEntry( "OneSpace", reader->bonespace ); | 4636 | reader->bonespace = config.readBoolEntry( "OneSpace", reader->bonespace ); |
4632 | reader->bunindent = config.readBoolEntry( "Unindent", reader->bunindent ); | 4637 | reader->bunindent = config.readBoolEntry( "Unindent", reader->bunindent ); |
4633 | reader->brepara = config.readBoolEntry( "Repara", reader->brepara ); | 4638 | reader->brepara = config.readBoolEntry( "Repara", reader->brepara ); |
4634 | reader->m_reparastring = config.readEntry( "ReparaString", reader->m_reparastring); | 4639 | reader->m_reparastring = config.readEntry( "ReparaString", reader->m_reparastring); |
4635 | m_bgtype = (bground)config.readNumEntry( "BackgroundType" , m_bgtype ); | 4640 | m_bgtype = (bground)config.readNumEntry( "BackgroundType" , m_bgtype ); |
4636 | m_themename = config.readEntry("Theme", m_themename ); | 4641 | m_themename = config.readEntry("Theme", m_themename ); |
4637 | reader->bdblspce = config.readBoolEntry( "DoubleSpace", reader->bdblspce ); | 4642 | reader->bdblspce = config.readBoolEntry( "DoubleSpace", reader->bdblspce ); |
4638 | reader->bindenter = config.readNumEntry( "Indent", reader->bindenter ); | 4643 | reader->bindenter = config.readNumEntry( "Indent", reader->bindenter ); |
4639 | reader->m_textsize = config.readNumEntry( "FontSize", reader->m_textsize ); | 4644 | reader->m_textsize = config.readNumEntry( "FontSize", reader->m_textsize ); |
4640 | reader->m_delay = config.readNumEntry( "ScrollDelay", reader->m_delay); | 4645 | reader->m_delay = config.readNumEntry( "ScrollDelay", reader->m_delay); |
4641 | reader->m_scrollstep = config.readNumEntry( "ScrollStep", reader->m_scrollstep); | 4646 | reader->m_scrollstep = config.readNumEntry( "ScrollStep", reader->m_scrollstep); |
4642 | reader->m_scrolltype = config.readNumEntry( "ScrollType", reader->m_scrolltype); | 4647 | reader->m_scrolltype = config.readNumEntry( "ScrollType", reader->m_scrolltype); |
4643 | if (full) | 4648 | if (full) |
4644 | { | 4649 | { |
4645 | reader->m_lastfile = config.readEntry( "LastFile", reader->m_lastfile ); | 4650 | reader->m_lastfile = config.readEntry( "LastFile", reader->m_lastfile ); |
4646 | reader->m_lastposn = config.readNumEntry( "LastPosn", reader->m_lastposn ); | 4651 | reader->m_lastposn = config.readNumEntry( "LastPosn", reader->m_lastposn ); |
4647 | } | 4652 | } |
4648 | reader->m_bpagemode = config.readBoolEntry( "PageMode", reader->m_bpagemode ); | 4653 | reader->m_bpagemode = config.readBoolEntry( "PageMode", reader->m_bpagemode ); |
4649 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", reader->m_bMonoSpaced); | 4654 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", reader->m_bMonoSpaced); |
4650 | reader->m_rotated = config.readBoolEntry( "IsRotated", reader->m_rotated ); | 4655 | reader->m_rotated = config.readBoolEntry( "IsRotated", reader->m_rotated ); |
4651 | m_statusstring = config.readEntry("StatusContent", m_statusstring); | 4656 | m_statusstring = config.readEntry("StatusContent", m_statusstring); |
4652 | m_statusishidden = config.readBoolEntry("StatusHidden", m_statusishidden); | 4657 | m_statusishidden = config.readBoolEntry("StatusHidden", m_statusishidden); |
4653 | m_background = config.readNumEntry( "Background", m_background ); | 4658 | m_background = config.readNumEntry( "Background", m_background ); |
4654 | reader->setBackground(getcolour(m_background)); | 4659 | reader->setBackground(getcolour(m_background)); |
4655 | m_foreground = config.readNumEntry( "Foreground", m_foreground ); | 4660 | m_foreground = config.readNumEntry( "Foreground", m_foreground ); |
4656 | reader->setForeground(getcolour(m_foreground)); | 4661 | reader->setForeground(getcolour(m_foreground)); |
4657 | m_scrollcolor = config.readNumEntry( "ScrollColour", m_scrollcolor); | 4662 | m_scrollcolor = config.readNumEntry( "ScrollColour", m_scrollcolor); |
4658 | setscrollcolour(); | 4663 | setscrollcolour(); |
4659 | m_scrollbarcolor = config.readNumEntry( "ScrollBarColour", m_scrollbarcolor); | 4664 | m_scrollbarcolor = config.readNumEntry( "ScrollBarColour", m_scrollbarcolor); |
4660 | setscrollbarcolour(); | 4665 | setscrollbarcolour(); |
4661 | reader->hyphenate = config.readBoolEntry( "Hyphenate", reader->hyphenate ); | 4666 | reader->hyphenate = config.readBoolEntry( "Hyphenate", reader->hyphenate ); |
4662 | // reader->buffdoc.setCustomHyphen(config.readBoolEntry( "CustomHyphen", false )); | 4667 | // reader->buffdoc.setCustomHyphen(config.readBoolEntry( "CustomHyphen", false )); |
4663 | reader->m_swapmouse = config.readBoolEntry( "SwapMouse", reader->m_swapmouse); | 4668 | reader->m_swapmouse = config.readBoolEntry( "SwapMouse", reader->m_swapmouse); |
4664 | reader->m_fontname = config.readEntry( "Fontname", reader->m_fontname ); | 4669 | reader->m_fontname = config.readEntry( "Fontname", reader->m_fontname ); |
4665 | reader->m_encd = config.readNumEntry( "Encoding", reader->m_encd ); | 4670 | reader->m_encd = config.readNumEntry( "Encoding", reader->m_encd ); |
4666 | reader->m_charpc = config.readNumEntry( "CharSpacing", reader->m_charpc ); | 4671 | reader->m_charpc = config.readNumEntry( "CharSpacing", reader->m_charpc ); |
4667 | reader->m_overlap = config.readNumEntry( "Overlap", reader->m_overlap ); | 4672 | reader->m_overlap = config.readNumEntry( "Overlap", reader->m_overlap ); |
4668 | reader->m_abstopmargin = config.readNumEntry( "Top Margin", reader->m_abstopmargin ); | 4673 | reader->m_abstopmargin = config.readNumEntry( "Top Margin", reader->m_abstopmargin ); |
4669 | reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", reader->m_absbottommargin ); | 4674 | reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", reader->m_absbottommargin ); |
4670 | reader->m_absleft_border = config.readNumEntry( "Left Margin", reader->m_absleft_border ); | 4675 | reader->m_absleft_border = config.readNumEntry( "Left Margin", reader->m_absleft_border ); |
4671 | reader->m_absright_border = config.readNumEntry( "Right Margin", reader->m_absright_border ); | 4676 | reader->m_absright_border = config.readNumEntry( "Right Margin", reader->m_absright_border ); |
4672 | m_scrollishidden = config.readBoolEntry( "HideScrollBar", m_scrollishidden ); | 4677 | m_scrollishidden = config.readBoolEntry( "HideScrollBar", m_scrollishidden ); |
4673 | m_hidebars = config.readBoolEntry( "HideToolBar", m_hidebars ); | 4678 | m_hidebars = config.readBoolEntry( "HideToolBar", m_hidebars ); |
4674 | reader->brepalm = config.readBoolEntry( "Repalm", reader->brepalm ); | 4679 | reader->brepalm = config.readBoolEntry( "Repalm", reader->brepalm ); |
4675 | reader->bunderlineLink = config.readBoolEntry( "UnderlineLink", reader->bunderlineLink ); | 4680 | reader->bunderlineLink = config.readBoolEntry( "UnderlineLink", reader->bunderlineLink ); |
4676 | reader->bkern = config.readBoolEntry( "Kern", reader->bkern ); | 4681 | reader->bkern = config.readBoolEntry( "Kern", reader->bkern ); |
4677 | reader->bremap = config.readBoolEntry( "Remap", reader->bremap ); | 4682 | reader->bremap = config.readBoolEntry( "Remap", reader->bremap ); |
4678 | reader->bmakebold = config.readBoolEntry( "MakeBold", reader->bmakebold ); | 4683 | reader->bmakebold = config.readBoolEntry( "MakeBold", reader->bmakebold ); |
4679 | reader->setContinuous(config.readBoolEntry( "Continuous", reader->m_continuousDocument )); | 4684 | reader->setContinuous(config.readBoolEntry( "Continuous", reader->m_continuousDocument )); |
4680 | reader->setDoubleBuffer(config.readBoolEntry("DoubleBuffer", reader->m_doubleBuffered)); | 4685 | reader->setDoubleBuffer(config.readBoolEntry("DoubleBuffer", reader->m_doubleBuffered)); |
4681 | m_targetapp = config.readEntry( "TargetApp", m_targetapp ); | 4686 | m_targetapp = config.readEntry( "TargetApp", m_targetapp ); |
4682 | m_targetmsg = config.readEntry( "TargetMsg", m_targetmsg ); | 4687 | m_targetmsg = config.readEntry( "TargetMsg", m_targetmsg ); |
4683 | #ifdef _SCROLLPIPE | 4688 | #ifdef _SCROLLPIPE |
4684 | reader->m_pipetarget = config.readEntry( "PipeTarget", reader->m_pipetarget ); | 4689 | reader->m_pipetarget = config.readEntry( "PipeTarget", reader->m_pipetarget ); |
4685 | reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); | 4690 | reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); |
4686 | #endif | 4691 | #endif |
4687 | m_twoTouch = config.readBoolEntry( "TwoTouch", m_twoTouch); | 4692 | m_twoTouch = config.readBoolEntry( "TwoTouch", m_twoTouch); |
4688 | m_doAnnotation = config.readBoolEntry( "Annotation", m_doAnnotation); | 4693 | m_doAnnotation = config.readBoolEntry( "Annotation", m_doAnnotation); |
4689 | m_doDictionary = config.readBoolEntry( "Dictionary", m_doDictionary); | 4694 | m_doDictionary = config.readBoolEntry( "Dictionary", m_doDictionary); |
4690 | m_doClipboard = config.readBoolEntry( "Clipboard", m_doClipboard); | 4695 | m_doClipboard = config.readBoolEntry( "Clipboard", m_doClipboard); |
4691 | m_doOutput = config.readBoolEntry( "OutputTgt", m_doOutput); | 4696 | m_doOutput = config.readBoolEntry( "OutputTgt", m_doOutput); |
4692 | #ifdef USEQPE | 4697 | #ifdef USEQPE |
4693 | m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", m_grabkeyboard); | 4698 | m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", m_grabkeyboard); |
4694 | #endif | 4699 | #endif |
4695 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", m_propogatefontchange); | 4700 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", m_propogatefontchange); |
4696 | reader->setBaseSize(config.readNumEntry( "Basesize", reader->getBaseSize() )); | 4701 | reader->setBaseSize(config.readNumEntry( "Basesize", reader->getBaseSize() )); |
4697 | reader->setTwoTouch(m_twoTouch); | 4702 | reader->setTwoTouch(m_twoTouch); |