summaryrefslogtreecommitdiff
authorpaule <paule>2007-07-08 08:37:52 (UTC)
committer paule <paule>2007-07-08 08:37:52 (UTC)
commitb07e25cd398620dafb9ce01982267588645d99a9 (patch) (unidiff)
tree41e01245b65ff07efce13743a45eefac7923fdcf
parent4fb748a55cdd77f4bab8dc692ab8ebae62609abe (diff)
downloadopie-b07e25cd398620dafb9ce01982267588645d99a9.zip
opie-b07e25cd398620dafb9ce01982267588645d99a9.tar.gz
opie-b07e25cd398620dafb9ce01982267588645d99a9.tar.bz2
Fix copying unicode block to clipboard. See bug #1766. Patch from polyonymous.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp
index b985094..4f0f0a1 100644
--- a/noncore/apps/opie-reader/QTReaderApp.cpp
+++ b/noncore/apps/opie-reader/QTReaderApp.cpp
@@ -1793,1537 +1793,1537 @@ void QTReaderApp::buttonActionSelected(QAction* _a)
1793 m_spaceTarget = ActNameToInt(_a->text()); 1793 m_spaceTarget = ActNameToInt(_a->text());
1794} 1794}
1795*/ 1795*/
1796QTReaderApp::~QTReaderApp() 1796QTReaderApp::~QTReaderApp()
1797{ 1797{
1798} 1798}
1799 1799
1800void QTReaderApp::autoScroll(bool _b) 1800void 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
1806void QTReaderApp::zoomin() 1806void 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
1813void QTReaderApp::zoomout() 1813void 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
1820void QTReaderApp::clearBkmkList() 1820void 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
1828void QTReaderApp::fileClose() 1828void 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
1873void QTReaderApp::updatefileinfo() 1873void 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
1919void QTReaderApp::fileOpen() 1919void 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
1933void QTReaderApp::fileOpen2() 1933void 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
1971QString QTReaderApp::usefilebrowser() 1971QString 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
2007void QTReaderApp::showgraphic(QImage& pm) 2007void 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
2015void QTReaderApp::showbuttonprefs() 2015void 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
2023void QTReaderApp::showprefs() 2023void 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
2240void QTReaderApp::showtoolbarprefs() 2240void 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
2322void QTReaderApp::showinfo() 2322void 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
2375void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn, size_t posn2) 2375void 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
2407void QTReaderApp::addAnno(const QString& name, const QString& text) 2407void 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
2455bool QTReaderApp::findNextBookmark(size_t start) 2455bool 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
2473void QTReaderApp::addanno() 2473void 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
2494void QTReaderApp::infoClose() 2494void 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/*
2529void QTReaderApp::fileRevert() 2529void QTReaderApp::fileRevert()
2530{ 2530{
2531 clear(); 2531 clear();
2532 fileOpen(); 2532 fileOpen();
2533} 2533}
2534 2534
2535void QTReaderApp::editCut() 2535void 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*/
2542void QTReaderApp::editMark() 2542void QTReaderApp::editMark()
2543{ 2543{
2544 m_savedpos = reader->pagelocate(); 2544 m_savedpos = reader->pagelocate();
2545} 2545}
2546 2546
2547void QTReaderApp::editCopy() 2547void 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 += QChar(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
2568void QTReaderApp::gotoStart() 2568void QTReaderApp::gotoStart()
2569{ 2569{
2570 reader->locate(reader->buffdoc.startSection()); 2570 reader->locate(reader->buffdoc.startSection());
2571} 2571}
2572 2572
2573void QTReaderApp::gotoEnd() 2573void QTReaderApp::gotoEnd()
2574{ 2574{
2575 reader->dopageup(reader->buffdoc.endSection()); 2575 reader->dopageup(reader->buffdoc.endSection());
2576} 2576}
2577 2577
2578void QTReaderApp::pageup() 2578void QTReaderApp::pageup()
2579{ 2579{
2580 reader->NavUp(); 2580 reader->NavUp();
2581} 2581}
2582 2582
2583void QTReaderApp::pagedn() 2583void QTReaderApp::pagedn()
2584{ 2584{
2585 reader->NavDown(); 2585 reader->NavDown();
2586} 2586}
2587 2587
2588void QTReaderApp::pagemode(bool _b) 2588void QTReaderApp::pagemode(bool _b)
2589{ 2589{
2590 reader->setpagemode(_b); 2590 reader->setpagemode(_b);
2591} 2591}
2592 2592
2593/* 2593/*
2594void QTReaderApp::setspacing() 2594void 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*/
2603void QTReaderApp::settarget() 2603void 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/*
2614void QTReaderApp::do_mono(const QString& lcn) 2614void 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/*
2630void QTReaderApp::editPaste() 2630void 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
2638void QTReaderApp::editFind() 2638void 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
2655void QTReaderApp::findNext() 2655void 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
2670void QTReaderApp::findClose() 2670void 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
2689void QTReaderApp::regClose() 2689void 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
2701bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QString& arg) 2701bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QString& arg)
2702#else 2702#else
2703bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg) 2703bool 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
2774void QTReaderApp::search(const QString & arg) 2774void 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
2807void QTReaderApp::search() 2807void QTReaderApp::search()
2808{ 2808{
2809 findNext(); 2809 findNext();
2810} 2810}
2811#endif 2811#endif
2812 2812
2813void QTReaderApp::openFile( const QString &f, unsigned int loc ) 2813void 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/*
2855void QTReaderApp::resizeEvent(QResizeEvent* e) 2855void 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*/
2864void QTReaderApp::handlekey(QKeyEvent* e) 2864void 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)
2963void QTReaderApp::focusInEvent(QFocusEvent *) 2963void 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
2976void QTReaderApp::resizeEvent(QResizeEvent *) 2976void 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
2990void QTReaderApp::showEditTools() 2990void 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/*
3089void QTReaderApp::save() 3089void 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
3119void QTReaderApp::clear() 3119void 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
3131void QTReaderApp::updateCaption() 3131void 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
3143void QTReaderApp::setDocument(const QString& fileref) 3143void 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
3150void QTReaderApp::closeEvent( QCloseEvent *e ) 3150void 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 int ret = QMessageBox::warning(this, PROGNAME, 3161 int ret = QMessageBox::warning(this, PROGNAME,
3162tr("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); 3162tr("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) 3163 if (ret == 0)
3164 { 3164 {
3165 m_buttonprefs->mapkey(Qt::NoButton, Key_Escape); 3165 m_buttonprefs->mapkey(Qt::NoButton, Key_Escape);
3166 } 3166 }
3167 e->ignore(); 3167 e->ignore();
3168 } 3168 }
3169 else if (m_dontSave) 3169 else if (m_dontSave)
3170 { 3170 {
3171 e->accept(); 3171 e->accept();
3172 } 3172 }
3173 else 3173 else
3174 { 3174 {
3175 if (editorStack->visibleWidget() == reader) 3175 if (editorStack->visibleWidget() == reader)
3176 { 3176 {
3177 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)
3178 { 3178 {
3179 //qDebug("Close disabled"); 3179 //qDebug("Close disabled");
3180 m_bcloseDisabled = false; 3180 m_bcloseDisabled = false;
3181 e->ignore(); 3181 e->ignore();
3182 } 3182 }
3183 else 3183 else
3184 { 3184 {
3185 if (m_fontVisible) 3185 if (m_fontVisible)
3186 { 3186 {
3187 m_fontBar->hide(); 3187 m_fontBar->hide();
3188 m_fontVisible = false; 3188 m_fontVisible = false;
3189 e->ignore(); 3189 e->ignore();
3190 return; 3190 return;
3191 } 3191 }
3192 if (regVisible) 3192 if (regVisible)
3193 { 3193 {
3194 regBar->hide(); 3194 regBar->hide();
3195#ifdef USEQPE 3195#ifdef USEQPE
3196 Global::hideInputMethod(); 3196 Global::hideInputMethod();
3197#endif 3197#endif
3198 regVisible = false; 3198 regVisible = false;
3199 e->ignore(); 3199 e->ignore();
3200 return; 3200 return;
3201 } 3201 }
3202 if (searchVisible) 3202 if (searchVisible)
3203 { 3203 {
3204 searchBar->hide(); 3204 searchBar->hide();
3205#ifdef USEQPE 3205#ifdef USEQPE
3206 Global::hideInputMethod(); 3206 Global::hideInputMethod();
3207#endif 3207#endif
3208 searchVisible = false; 3208 searchVisible = false;
3209 e->ignore(); 3209 e->ignore();
3210 return; 3210 return;
3211 } 3211 }
3212 if (m_fBkmksChanged && pBkmklist != NULL) 3212 if (m_fBkmksChanged && pBkmklist != NULL)
3213 { 3213 {
3214 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)
3215 savebkmks(); 3215 savebkmks();
3216 delete pBkmklist; 3216 delete pBkmklist;
3217 reader->pBkmklist = pBkmklist = NULL; 3217 reader->pBkmklist = pBkmklist = NULL;
3218 m_fBkmksChanged = false; 3218 m_fBkmksChanged = false;
3219 } 3219 }
3220 updatefileinfo(); 3220 updatefileinfo();
3221 saveprefs(); 3221 saveprefs();
3222 e->accept(); 3222 e->accept();
3223 } 3223 }
3224 } 3224 }
3225 else 3225 else
3226 { 3226 {
3227 showEditTools(); 3227 showEditTools();
3228 m_disableesckey = true; 3228 m_disableesckey = true;
3229 } 3229 }
3230 } 3230 }
3231} 3231}
3232 3232
3233void QTReaderApp::do_gotomark() 3233void QTReaderApp::do_gotomark()
3234{ 3234{
3235 m_nBkmkAction = cGotoBkmk; 3235 m_nBkmkAction = cGotoBkmk;
3236 if (!listbkmk(pBkmklist)) 3236 if (!listbkmk(pBkmklist))
3237 QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); 3237 QMessageBox::information(this, PROGNAME, "No bookmarks in memory");
3238} 3238}
3239 3239
3240void QTReaderApp::do_delmark() 3240void QTReaderApp::do_delmark()
3241{ 3241{
3242 m_nBkmkAction = cDelBkmk; 3242 m_nBkmkAction = cDelBkmk;
3243 if (!listbkmk(pBkmklist)) 3243 if (!listbkmk(pBkmklist))
3244 QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); 3244 QMessageBox::information(this, PROGNAME, "No bookmarks in memory");
3245} 3245}
3246 3246
3247bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab, bool presel) 3247bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab, bool presel)
3248{ 3248{
3249 bkmkselector->clear(); 3249 bkmkselector->clear();
3250 if (_lab.isEmpty()) 3250 if (_lab.isEmpty())
3251 bkmkselector->setText("Cancel"); 3251 bkmkselector->setText("Cancel");
3252 else 3252 else
3253 bkmkselector->setText(_lab); 3253 bkmkselector->setText(_lab);
3254 int cnt = 0; 3254 int cnt = 0;
3255 int slt = -1; 3255 int slt = -1;
3256 if (plist != NULL) 3256 if (plist != NULL)
3257 { 3257 {
3258 for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) 3258 for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++)
3259 { 3259 {
3260 if (presel) 3260 if (presel)
3261 { 3261 {
3262 Bkmk* p = i.pContent(); 3262 Bkmk* p = i.pContent();
3263 if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) 3263 if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile)
3264 { 3264 {
3265 slt = cnt; 3265 slt = cnt;
3266 } 3266 }
3267 } 3267 }
3268#ifdef _UNICODE 3268#ifdef _UNICODE
3269 // qDebug("Item:%s", (const char*)toQString(i->name())); 3269 // qDebug("Item:%s", (const char*)toQString(i->name()));
3270 bkmkselector->insertItem(toQString(i->name()), cnt++); 3270 bkmkselector->insertItem(toQString(i->name()), cnt++);
3271#else 3271#else
3272 bkmkselector->insertItem(i->name(), cnt++); 3272 bkmkselector->insertItem(i->name(), cnt++);
3273#endif 3273#endif
3274 3274
3275 } 3275 }
3276 } 3276 }
3277 if (cnt > 0) 3277 if (cnt > 0)
3278 { 3278 {
3279 hidetoolbars(); 3279 hidetoolbars();
3280 editorStack->raiseWidget( bkmkselector ); 3280 editorStack->raiseWidget( bkmkselector );
3281 if (slt != -1) bkmkselector->setCurrentItem(slt); 3281 if (slt != -1) bkmkselector->setCurrentItem(slt);
3282 return true; 3282 return true;
3283 } 3283 }
3284 else 3284 else
3285 return false; 3285 return false;
3286} 3286}
3287 3287
3288void QTReaderApp::do_autogen() 3288void QTReaderApp::do_autogen()
3289{ 3289{
3290 m_nRegAction = cAutoGen; 3290 m_nRegAction = cAutoGen;
3291 regEdit->setText(m_autogenstr); 3291 regEdit->setText(m_autogenstr);
3292 do_regedit(); 3292 do_regedit();
3293} 3293}
3294 3294
3295void QTReaderApp::do_regedit() 3295void QTReaderApp::do_regedit()
3296{ 3296{
3297// fileBar->hide(); 3297// fileBar->hide();
3298 reader->bDoUpdates = false; 3298 reader->bDoUpdates = false;
3299// qDebug("Showing regbar"); 3299// qDebug("Showing regbar");
3300 regBar->show(); 3300 regBar->show();
3301// qDebug("Showing kbd"); 3301// qDebug("Showing kbd");
3302#ifdef USEQPE 3302#ifdef USEQPE
3303 Global::showInputMethod(); 3303 Global::showInputMethod();
3304#endif 3304#endif
3305 regVisible = true; 3305 regVisible = true;
3306 regEdit->setFocus(); 3306 regEdit->setFocus();
3307// qApp->processEvents(); 3307// qApp->processEvents();
3308 reader->bDoUpdates = true; 3308 reader->bDoUpdates = true;
3309 reader->update(); 3309 reader->update();
3310} 3310}
3311 3311
3312bool QTReaderApp::openfrombkmk(Bkmk* bk) 3312bool QTReaderApp::openfrombkmk(Bkmk* bk)
3313{ 3313{
3314 QString fn = toQString( 3314 QString fn = toQString(
3315 CFiledata(bk->anno()).name() 3315 CFiledata(bk->anno()).name()
3316 ); 3316 );
3317 //qDebug("fileinfo"); 3317 //qDebug("fileinfo");
3318 if (!fn.isEmpty() && QFileInfo(fn).isFile()) 3318 if (!fn.isEmpty() && QFileInfo(fn).isFile())
3319 { 3319 {
3320 //qDebug("Opening"); 3320 //qDebug("Opening");
3321 struct stat fnstat; 3321 struct stat fnstat;
3322 stat((const char *)fn, &fnstat); 3322 stat((const char *)fn, &fnstat);
3323 3323
3324 if (CFiledata(bk->anno()).date() 3324 if (CFiledata(bk->anno()).date()
3325 != fnstat.st_mtime) 3325 != fnstat.st_mtime)
3326 { 3326 {
3327 CFiledata fd(bk->anno()); 3327 CFiledata fd(bk->anno());
3328 fd.setdate(fnstat.st_mtime); 3328 fd.setdate(fnstat.st_mtime);
3329 bk->value(0); 3329 bk->value(0);