summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/view/kateview.cpp2
-rw-r--r--noncore/apps/tinykate/libkate/view/kateviewdialog.cpp37
-rw-r--r--noncore/apps/tinykate/libkate/view/kateviewdialog.h2
3 files changed, 30 insertions, 11 deletions
diff --git a/noncore/apps/tinykate/libkate/view/kateview.cpp b/noncore/apps/tinykate/libkate/view/kateview.cpp
index 6453458..63e941f 100644
--- a/noncore/apps/tinykate/libkate/view/kateview.cpp
+++ b/noncore/apps/tinykate/libkate/view/kateview.cpp
@@ -1837,1025 +1837,1025 @@ void KateView::redoMultiple(int count) {
1837 myDoc->redo(c, count); 1837 myDoc->redo(c, count);
1838 myDoc->updateViews(); 1838 myDoc->updateViews();
1839} 1839}
1840 1840
1841void KateView::undoHistory() 1841void KateView::undoHistory()
1842{ 1842{
1843 UndoHistory *undoH; 1843 UndoHistory *undoH;
1844 1844
1845 undoH = new UndoHistory(this, this, "UndoHistory", true); 1845 undoH = new UndoHistory(this, this, "UndoHistory", true);
1846 1846
1847 undoH->setCaption(i18n("Undo/Redo History")); 1847 undoH->setCaption(i18n("Undo/Redo History"));
1848 1848
1849 connect(this,SIGNAL(newUndo()),undoH,SLOT(newUndo())); 1849 connect(this,SIGNAL(newUndo()),undoH,SLOT(newUndo()));
1850 connect(undoH,SIGNAL(undo(int)),this,SLOT(undoMultiple(int))); 1850 connect(undoH,SIGNAL(undo(int)),this,SLOT(undoMultiple(int)));
1851 connect(undoH,SIGNAL(redo(int)),this,SLOT(redoMultiple(int))); 1851 connect(undoH,SIGNAL(redo(int)),this,SLOT(redoMultiple(int)));
1852 1852
1853 undoH->exec(); 1853 undoH->exec();
1854 1854
1855 delete undoH; 1855 delete undoH;
1856} 1856}
1857 1857
1858static void kwview_addToStrList(QStringList &list, const QString &str) { 1858static void kwview_addToStrList(QStringList &list, const QString &str) {
1859 if (list.count() > 0) { 1859 if (list.count() > 0) {
1860 if (list.first() == str) return; 1860 if (list.first() == str) return;
1861 QStringList::Iterator it; 1861 QStringList::Iterator it;
1862 it = list.find(str); 1862 it = list.find(str);
1863 if (*it != 0L) list.remove(it); 1863 if (*it != 0L) list.remove(it);
1864 if (list.count() >= 16) list.remove(list.fromLast()); 1864 if (list.count() >= 16) list.remove(list.fromLast());
1865 } 1865 }
1866 list.prepend(str); 1866 list.prepend(str);
1867} 1867}
1868 1868
1869void KateView::find() { 1869void KateView::find() {
1870 SearchDialog *searchDialog; 1870 SearchDialog *searchDialog;
1871 1871
1872 if (!myDoc->hasMarkedText()) searchFlags &= ~KateView::sfSelected; 1872 if (!myDoc->hasMarkedText()) searchFlags &= ~KateView::sfSelected;
1873 1873
1874 searchDialog = new SearchDialog(this, myDoc->searchForList, myDoc->replaceWithList, 1874 searchDialog = new SearchDialog(this, myDoc->searchForList, myDoc->replaceWithList,
1875 searchFlags & ~KateView::sfReplace); 1875 searchFlags & ~KateView::sfReplace);
1876 1876
1877 // If the user has marked some text we use that otherwise 1877 // If the user has marked some text we use that otherwise
1878 // use the word under the cursor. 1878 // use the word under the cursor.
1879 QString str; 1879 QString str;
1880 if (myDoc->hasMarkedText()) 1880 if (myDoc->hasMarkedText())
1881 str = markedText(); 1881 str = markedText();
1882 1882
1883 if (str.isEmpty()) 1883 if (str.isEmpty())
1884 str = currentWord(); 1884 str = currentWord();
1885 1885
1886 if (!str.isEmpty()) 1886 if (!str.isEmpty())
1887 { 1887 {
1888 str.replace(QRegExp("^\n"), ""); 1888 str.replace(QRegExp("^\n"), "");
1889 int pos=str.find("\n"); 1889 int pos=str.find("\n");
1890 if (pos>-1) 1890 if (pos>-1)
1891 str=str.left(pos); 1891 str=str.left(pos);
1892 searchDialog->setSearchText( str ); 1892 searchDialog->setSearchText( str );
1893 } 1893 }
1894 1894
1895 myViewInternal->focusOutEvent(0L);// QT bug ? 1895 myViewInternal->focusOutEvent(0L);// QT bug ?
1896 if (searchDialog->exec() == QDialog::Accepted) { 1896 if (searchDialog->exec() == QDialog::Accepted) {
1897 kwview_addToStrList(myDoc->searchForList, searchDialog->getSearchFor()); 1897 kwview_addToStrList(myDoc->searchForList, searchDialog->getSearchFor());
1898 searchFlags = searchDialog->getFlags() | (searchFlags & KateView::sfPrompt); 1898 searchFlags = searchDialog->getFlags() | (searchFlags & KateView::sfPrompt);
1899 initSearch(s, searchFlags); 1899 initSearch(s, searchFlags);
1900 findAgain(s); 1900 findAgain(s);
1901 } 1901 }
1902 delete searchDialog; 1902 delete searchDialog;
1903} 1903}
1904 1904
1905void KateView::replace() { 1905void KateView::replace() {
1906 SearchDialog *searchDialog; 1906 SearchDialog *searchDialog;
1907 1907
1908 if (isReadOnly()) return; 1908 if (isReadOnly()) return;
1909 1909
1910 if (!myDoc->hasMarkedText()) searchFlags &= ~KateView::sfSelected; 1910 if (!myDoc->hasMarkedText()) searchFlags &= ~KateView::sfSelected;
1911 searchDialog = new SearchDialog(this, myDoc->searchForList, myDoc->replaceWithList, 1911 searchDialog = new SearchDialog(this, myDoc->searchForList, myDoc->replaceWithList,
1912 searchFlags | KateView::sfReplace); 1912 searchFlags | KateView::sfReplace);
1913 1913
1914 // If the user has marked some text we use that otherwise 1914 // If the user has marked some text we use that otherwise
1915 // use the word under the cursor. 1915 // use the word under the cursor.
1916 QString str; 1916 QString str;
1917 if (myDoc->hasMarkedText()) 1917 if (myDoc->hasMarkedText())
1918 str = markedText(); 1918 str = markedText();
1919 1919
1920 if (str.isEmpty()) 1920 if (str.isEmpty())
1921 str = currentWord(); 1921 str = currentWord();
1922 1922
1923 if (!str.isEmpty()) 1923 if (!str.isEmpty())
1924 { 1924 {
1925 str.replace(QRegExp("^\n"), ""); 1925 str.replace(QRegExp("^\n"), "");
1926 int pos=str.find("\n"); 1926 int pos=str.find("\n");
1927 if (pos>-1) 1927 if (pos>-1)
1928 str=str.left(pos); 1928 str=str.left(pos);
1929 searchDialog->setSearchText( str ); 1929 searchDialog->setSearchText( str );
1930 } 1930 }
1931 1931
1932 myViewInternal->focusOutEvent(0L);// QT bug ? 1932 myViewInternal->focusOutEvent(0L);// QT bug ?
1933 if (searchDialog->exec() == QDialog::Accepted) { 1933 if (searchDialog->exec() == QDialog::Accepted) {
1934// myDoc->recordReset(); 1934// myDoc->recordReset();
1935 kwview_addToStrList(myDoc->searchForList, searchDialog->getSearchFor()); 1935 kwview_addToStrList(myDoc->searchForList, searchDialog->getSearchFor());
1936 kwview_addToStrList(myDoc->replaceWithList, searchDialog->getReplaceWith()); 1936 kwview_addToStrList(myDoc->replaceWithList, searchDialog->getReplaceWith());
1937 searchFlags = searchDialog->getFlags(); 1937 searchFlags = searchDialog->getFlags();
1938 initSearch(s, searchFlags); 1938 initSearch(s, searchFlags);
1939 replaceAgain(); 1939 replaceAgain();
1940 } 1940 }
1941 delete searchDialog; 1941 delete searchDialog;
1942} 1942}
1943 1943
1944void KateView::gotoLine() { 1944void KateView::gotoLine() {
1945 GotoLineDialog *dlg; 1945 GotoLineDialog *dlg;
1946 PointStruc cursor; 1946 PointStruc cursor;
1947 1947
1948 dlg = new GotoLineDialog(this, myViewInternal->cursor.y + 1, myDoc->numLines()); 1948 dlg = new GotoLineDialog(this, myViewInternal->cursor.y + 1, myDoc->numLines());
1949// dlg = new GotoLineDialog(myViewInternal->cursor.y + 1, this); 1949// dlg = new GotoLineDialog(myViewInternal->cursor.y + 1, this);
1950 1950
1951 if (dlg->exec() == QDialog::Accepted) { 1951 if (dlg->exec() == QDialog::Accepted) {
1952// myDoc->recordReset(); 1952// myDoc->recordReset();
1953 cursor.x = 0; 1953 cursor.x = 0;
1954 cursor.y = dlg->getLine() - 1; 1954 cursor.y = dlg->getLine() - 1;
1955 myDoc->needPreHighlight(cursor.y); 1955 myDoc->needPreHighlight(cursor.y);
1956 myViewInternal->updateCursor(cursor); 1956 myViewInternal->updateCursor(cursor);
1957 myViewInternal->center(); 1957 myViewInternal->center();
1958 myViewInternal->updateView(KateView::ufUpdateOnScroll); 1958 myViewInternal->updateView(KateView::ufUpdateOnScroll);
1959 myDoc->updateViews(this); //uptade all other views except this one 1959 myDoc->updateViews(this); //uptade all other views except this one
1960 } 1960 }
1961 delete dlg; 1961 delete dlg;
1962} 1962}
1963 1963
1964 1964
1965void KateView::initSearch(SConfig &s, int flags) { 1965void KateView::initSearch(SConfig &s, int flags) {
1966 1966
1967 s.flags = flags; 1967 s.flags = flags;
1968 s.setPattern(myDoc->searchForList.first()); 1968 s.setPattern(myDoc->searchForList.first());
1969 1969
1970 if (!(s.flags & KateView::sfFromBeginning)) { 1970 if (!(s.flags & KateView::sfFromBeginning)) {
1971 // If we are continuing a backward search, make sure we do not get stuck 1971 // If we are continuing a backward search, make sure we do not get stuck
1972 // at an existing match. 1972 // at an existing match.
1973 s.cursor = myViewInternal->cursor; 1973 s.cursor = myViewInternal->cursor;
1974 TextLine::Ptr textLine = myDoc->getTextLine(s.cursor.y); 1974 TextLine::Ptr textLine = myDoc->getTextLine(s.cursor.y);
1975 QString const txt(textLine->getText(),textLine->length()); 1975 QString const txt(textLine->getText(),textLine->length());
1976 const QString searchFor= myDoc->searchForList.first(); 1976 const QString searchFor= myDoc->searchForList.first();
1977 int pos = s.cursor.x-searchFor.length()-1; 1977 int pos = s.cursor.x-searchFor.length()-1;
1978 if ( pos < 0 ) pos = 0; 1978 if ( pos < 0 ) pos = 0;
1979 pos= txt.find(searchFor, pos, s.flags & KateView::sfCaseSensitive); 1979 pos= txt.find(searchFor, pos, s.flags & KateView::sfCaseSensitive);
1980 if ( s.flags & KateView::sfBackward ) 1980 if ( s.flags & KateView::sfBackward )
1981 { 1981 {
1982 if ( pos <= s.cursor.x ) s.cursor.x= pos-1; 1982 if ( pos <= s.cursor.x ) s.cursor.x= pos-1;
1983 } 1983 }
1984 else 1984 else
1985 if ( pos == s.cursor.x ) s.cursor.x++; 1985 if ( pos == s.cursor.x ) s.cursor.x++;
1986 } else { 1986 } else {
1987 if (!(s.flags & KateView::sfBackward)) { 1987 if (!(s.flags & KateView::sfBackward)) {
1988 s.cursor.x = 0; 1988 s.cursor.x = 0;
1989 s.cursor.y = 0; 1989 s.cursor.y = 0;
1990 } else { 1990 } else {
1991 s.cursor.x = -1; 1991 s.cursor.x = -1;
1992 s.cursor.y = myDoc->lastLine(); 1992 s.cursor.y = myDoc->lastLine();
1993 } 1993 }
1994 s.flags |= KateView::sfFinished; 1994 s.flags |= KateView::sfFinished;
1995 } 1995 }
1996 if (!(s.flags & KateView::sfBackward)) { 1996 if (!(s.flags & KateView::sfBackward)) {
1997 if (!(s.cursor.x || s.cursor.y)) 1997 if (!(s.cursor.x || s.cursor.y))
1998 s.flags |= KateView::sfFinished; 1998 s.flags |= KateView::sfFinished;
1999 } 1999 }
2000 s.startCursor = s.cursor; 2000 s.startCursor = s.cursor;
2001} 2001}
2002 2002
2003void KateView::continueSearch(SConfig &s) { 2003void KateView::continueSearch(SConfig &s) {
2004 2004
2005 if (!(s.flags & KateView::sfBackward)) { 2005 if (!(s.flags & KateView::sfBackward)) {
2006 s.cursor.x = 0; 2006 s.cursor.x = 0;
2007 s.cursor.y = 0; 2007 s.cursor.y = 0;
2008 } else { 2008 } else {
2009 s.cursor.x = -1; 2009 s.cursor.x = -1;
2010 s.cursor.y = myDoc->lastLine(); 2010 s.cursor.y = myDoc->lastLine();
2011 } 2011 }
2012 s.flags |= KateView::sfFinished; 2012 s.flags |= KateView::sfFinished;
2013 s.flags &= ~KateView::sfAgain; 2013 s.flags &= ~KateView::sfAgain;
2014} 2014}
2015 2015
2016void KateView::findAgain(SConfig &s) { 2016void KateView::findAgain(SConfig &s) {
2017 int query; 2017 int query;
2018 PointStruc cursor; 2018 PointStruc cursor;
2019 QString str; 2019 QString str;
2020 2020
2021 QString searchFor = myDoc->searchForList.first(); 2021 QString searchFor = myDoc->searchForList.first();
2022 2022
2023 if( searchFor.isEmpty() ) { 2023 if( searchFor.isEmpty() ) {
2024 find(); 2024 find();
2025 return; 2025 return;
2026 } 2026 }
2027 2027
2028 do { 2028 do {
2029 query = KMessageBox::Cancel; 2029 query = KMessageBox::Cancel;
2030 if (myDoc->doSearch(s,searchFor)) { 2030 if (myDoc->doSearch(s,searchFor)) {
2031 cursor = s.cursor; 2031 cursor = s.cursor;
2032 if (!(s.flags & KateView::sfBackward)) 2032 if (!(s.flags & KateView::sfBackward))
2033 s.cursor.x += s.matchedLength; 2033 s.cursor.x += s.matchedLength;
2034 myViewInternal->updateCursor(s.cursor); //does deselectAll() 2034 myViewInternal->updateCursor(s.cursor); //does deselectAll()
2035 exposeFound(cursor,s.matchedLength,(s.flags & KateView::sfAgain) ? 0 : KateView::ufUpdateOnScroll,false); 2035 exposeFound(cursor,s.matchedLength,(s.flags & KateView::sfAgain) ? 0 : KateView::ufUpdateOnScroll,false);
2036 } else { 2036 } else {
2037 if (!(s.flags & KateView::sfFinished)) { 2037 if (!(s.flags & KateView::sfFinished)) {
2038 // ask for continue 2038 // ask for continue
2039 if (!(s.flags & KateView::sfBackward)) { 2039 if (!(s.flags & KateView::sfBackward)) {
2040 // forward search 2040 // forward search
2041 str = i18n("End of document reached.\n" 2041 str = i18n("End of document reached.\n"
2042 "Continue from the beginning?"); 2042 "Continue from the beginning?");
2043 query = KMessageBox::warningContinueCancel(this, 2043 query = KMessageBox::warningContinueCancel(this,
2044 str, i18n("Find"), i18n("Continue")); 2044 str, i18n("Find"), i18n("Continue"));
2045 } else { 2045 } else {
2046 // backward search 2046 // backward search
2047 str = i18n("Beginning of document reached.\n" 2047 str = i18n("Beginning of document reached.\n"
2048 "Continue from the end?"); 2048 "Continue from the end?");
2049 query = KMessageBox::warningContinueCancel(this, 2049 query = KMessageBox::warningContinueCancel(this,
2050 str, i18n("Find"), i18n("Continue")); 2050 str, i18n("Find"), i18n("Continue"));
2051 } 2051 }
2052 continueSearch(s); 2052 continueSearch(s);
2053 } else { 2053 } else {
2054 // wrapped 2054 // wrapped
2055 KMessageBox::sorry(this, 2055 KMessageBox::sorry(this,
2056 i18n("Search string '%1' not found!").arg(searchFor), 2056 i18n("Search string '%1' not found!").arg(searchFor),
2057 i18n("Find")); 2057 i18n("Find"));
2058 } 2058 }
2059 } 2059 }
2060 } while (query == KMessageBox::Continue); 2060 } while (query == KMessageBox::Continue);
2061} 2061}
2062 2062
2063void KateView::replaceAgain() { 2063void KateView::replaceAgain() {
2064 if (isReadOnly()) 2064 if (isReadOnly())
2065 return; 2065 return;
2066 2066
2067 replaces = 0; 2067 replaces = 0;
2068 if (s.flags & KateView::sfPrompt) { 2068 if (s.flags & KateView::sfPrompt) {
2069 doReplaceAction(-1); 2069 doReplaceAction(-1);
2070 } else { 2070 } else {
2071 doReplaceAction(KateView::srAll); 2071 doReplaceAction(KateView::srAll);
2072 } 2072 }
2073} 2073}
2074 2074
2075void KateView::doReplaceAction(int result, bool found) { 2075void KateView::doReplaceAction(int result, bool found) {
2076 int rlen; 2076 int rlen;
2077 PointStruc cursor; 2077 PointStruc cursor;
2078 bool started; 2078 bool started;
2079 2079
2080 QString searchFor = myDoc->searchForList.first(); 2080 QString searchFor = myDoc->searchForList.first();
2081 QString replaceWith = myDoc->replaceWithList.first(); 2081 QString replaceWith = myDoc->replaceWithList.first();
2082 rlen = replaceWith.length(); 2082 rlen = replaceWith.length();
2083 2083
2084 switch (result) { 2084 switch (result) {
2085 case KateView::srYes: //yes 2085 case KateView::srYes: //yes
2086 myDoc->recordStart(this, s.cursor, configFlags, 2086 myDoc->recordStart(this, s.cursor, configFlags,
2087 KateActionGroup::ugReplace, true); 2087 KateActionGroup::ugReplace, true);
2088 myDoc->recordReplace(s.cursor, s.matchedLength, replaceWith); 2088 myDoc->recordReplace(s.cursor, s.matchedLength, replaceWith);
2089 replaces++; 2089 replaces++;
2090 if (s.cursor.y == s.startCursor.y && s.cursor.x < s.startCursor.x) 2090 if (s.cursor.y == s.startCursor.y && s.cursor.x < s.startCursor.x)
2091 s.startCursor.x += rlen - s.matchedLength; 2091 s.startCursor.x += rlen - s.matchedLength;
2092 if (!(s.flags & KateView::sfBackward)) s.cursor.x += rlen; 2092 if (!(s.flags & KateView::sfBackward)) s.cursor.x += rlen;
2093 myDoc->recordEnd(this, s.cursor, configFlags | KateView::cfPersistent); 2093 myDoc->recordEnd(this, s.cursor, configFlags | KateView::cfPersistent);
2094 break; 2094 break;
2095 case KateView::srNo: //no 2095 case KateView::srNo: //no
2096 if (!(s.flags & KateView::sfBackward)) s.cursor.x += s.matchedLength; 2096 if (!(s.flags & KateView::sfBackward)) s.cursor.x += s.matchedLength;
2097 break; 2097 break;
2098 case KateView::srAll: //replace all 2098 case KateView::srAll: //replace all
2099 deleteReplacePrompt(); 2099 deleteReplacePrompt();
2100 do { 2100 do {
2101 started = false; 2101 started = false;
2102 while (found || myDoc->doSearch(s,searchFor)) { 2102 while (found || myDoc->doSearch(s,searchFor)) {
2103 if (!started) { 2103 if (!started) {
2104 found = false; 2104 found = false;
2105 myDoc->recordStart(this, s.cursor, configFlags, 2105 myDoc->recordStart(this, s.cursor, configFlags,
2106 KateActionGroup::ugReplace); 2106 KateActionGroup::ugReplace);
2107 started = true; 2107 started = true;
2108 } 2108 }
2109 myDoc->recordReplace(s.cursor, s.matchedLength, replaceWith); 2109 myDoc->recordReplace(s.cursor, s.matchedLength, replaceWith);
2110 replaces++; 2110 replaces++;
2111 if (s.cursor.y == s.startCursor.y && s.cursor.x < s.startCursor.x) 2111 if (s.cursor.y == s.startCursor.y && s.cursor.x < s.startCursor.x)
2112 s.startCursor.x += rlen - s.matchedLength; 2112 s.startCursor.x += rlen - s.matchedLength;
2113 if (!(s.flags & KateView::sfBackward)) s.cursor.x += rlen; 2113 if (!(s.flags & KateView::sfBackward)) s.cursor.x += rlen;
2114 } 2114 }
2115 if (started) myDoc->recordEnd(this, s.cursor, 2115 if (started) myDoc->recordEnd(this, s.cursor,
2116 configFlags | KateView::cfPersistent); 2116 configFlags | KateView::cfPersistent);
2117 } while (!askReplaceEnd()); 2117 } while (!askReplaceEnd());
2118 return; 2118 return;
2119 case KateView::srCancel: //cancel 2119 case KateView::srCancel: //cancel
2120 deleteReplacePrompt(); 2120 deleteReplacePrompt();
2121 return; 2121 return;
2122 default: 2122 default:
2123 replacePrompt = 0L; 2123 replacePrompt = 0L;
2124 } 2124 }
2125 2125
2126 do { 2126 do {
2127 if (myDoc->doSearch(s,searchFor)) { 2127 if (myDoc->doSearch(s,searchFor)) {
2128 //text found: highlight it, show replace prompt if needed and exit 2128 //text found: highlight it, show replace prompt if needed and exit
2129 cursor = s.cursor; 2129 cursor = s.cursor;
2130 if (!(s.flags & KateView::sfBackward)) cursor.x += s.matchedLength; 2130 if (!(s.flags & KateView::sfBackward)) cursor.x += s.matchedLength;
2131 myViewInternal->updateCursor(cursor); //does deselectAll() 2131 myViewInternal->updateCursor(cursor); //does deselectAll()
2132 exposeFound(s.cursor,s.matchedLength,(s.flags & KateView::sfAgain) ? 0 : KateView::ufUpdateOnScroll,true); 2132 exposeFound(s.cursor,s.matchedLength,(s.flags & KateView::sfAgain) ? 0 : KateView::ufUpdateOnScroll,true);
2133 if (replacePrompt == 0L) { 2133 if (replacePrompt == 0L) {
2134 replacePrompt = new ReplacePrompt(this); 2134 replacePrompt = new ReplacePrompt(this);
2135 myDoc->setPseudoModal(replacePrompt);//disable(); 2135 myDoc->setPseudoModal(replacePrompt);//disable();
2136 connect(replacePrompt,SIGNAL(clicked()),this,SLOT(replaceSlot())); 2136 connect(replacePrompt,SIGNAL(clicked()),this,SLOT(replaceSlot()));
2137 replacePrompt->show(); //this is not modal 2137 replacePrompt->show(); //this is not modal
2138 } 2138 }
2139 return; //exit if text found 2139 return; //exit if text found
2140 } 2140 }
2141 //nothing found: repeat until user cancels "repeat from beginning" dialog 2141 //nothing found: repeat until user cancels "repeat from beginning" dialog
2142 } while (!askReplaceEnd()); 2142 } while (!askReplaceEnd());
2143 deleteReplacePrompt(); 2143 deleteReplacePrompt();
2144} 2144}
2145 2145
2146void KateView::exposeFound(PointStruc &cursor, int slen, int flags, bool replace) { 2146void KateView::exposeFound(PointStruc &cursor, int slen, int flags, bool replace) {
2147 int x1, x2, y1, y2, xPos, yPos; 2147 int x1, x2, y1, y2, xPos, yPos;
2148 2148
2149 VConfig c; 2149 VConfig c;
2150 myViewInternal->getVConfig(c); 2150 myViewInternal->getVConfig(c);
2151 myDoc->selectLength(cursor,slen,c.flags); 2151 myDoc->selectLength(cursor,slen,c.flags);
2152 2152
2153 TextLine::Ptr textLine = myDoc->getTextLine(cursor.y); 2153 TextLine::Ptr textLine = myDoc->getTextLine(cursor.y);
2154 x1 = myDoc->textWidth(textLine,cursor.x) -10; 2154 x1 = myDoc->textWidth(textLine,cursor.x) -10;
2155 x2 = myDoc->textWidth(textLine,cursor.x + slen) +20; 2155 x2 = myDoc->textWidth(textLine,cursor.x + slen) +20;
2156 y1 = myDoc->fontHeight*cursor.y -10; 2156 y1 = myDoc->fontHeight*cursor.y -10;
2157 y2 = y1 + myDoc->fontHeight +30; 2157 y2 = y1 + myDoc->fontHeight +30;
2158 2158
2159 xPos = myViewInternal->xPos; 2159 xPos = myViewInternal->xPos;
2160 yPos = myViewInternal->yPos; 2160 yPos = myViewInternal->yPos;
2161 2161
2162 if (x1 < 0) x1 = 0; 2162 if (x1 < 0) x1 = 0;
2163 if (replace) y2 += 90; 2163 if (replace) y2 += 90;
2164 2164
2165 if (x1 < xPos || x2 > xPos + myViewInternal->width()) { 2165 if (x1 < xPos || x2 > xPos + myViewInternal->width()) {
2166 xPos = x2 - myViewInternal->width(); 2166 xPos = x2 - myViewInternal->width();
2167 } 2167 }
2168 if (y1 < yPos || y2 > yPos + myViewInternal->height()) { 2168 if (y1 < yPos || y2 > yPos + myViewInternal->height()) {
2169 xPos = x2 - myViewInternal->width(); 2169 xPos = x2 - myViewInternal->width();
2170 yPos = myDoc->fontHeight*cursor.y - height()/3; 2170 yPos = myDoc->fontHeight*cursor.y - height()/3;
2171 } 2171 }
2172 myViewInternal->setPos(xPos, yPos); 2172 myViewInternal->setPos(xPos, yPos);
2173 myViewInternal->updateView(flags);// | ufPos,xPos,yPos); 2173 myViewInternal->updateView(flags);// | ufPos,xPos,yPos);
2174 myDoc->updateViews(this); 2174 myDoc->updateViews(this);
2175} 2175}
2176 2176
2177void KateView::deleteReplacePrompt() { 2177void KateView::deleteReplacePrompt() {
2178 myDoc->setPseudoModal(0L); 2178 myDoc->setPseudoModal(0L);
2179} 2179}
2180 2180
2181bool KateView::askReplaceEnd() { 2181bool KateView::askReplaceEnd() {
2182 QString str; 2182 QString str;
2183 int query; 2183 int query;
2184 2184
2185 myDoc->updateViews(); 2185 myDoc->updateViews();
2186 if (s.flags & KateView::sfFinished) { 2186 if (s.flags & KateView::sfFinished) {
2187 // replace finished 2187 // replace finished
2188 str = i18n("%1 replacement(s) made").arg(replaces); 2188 str = i18n("%1 replacement(s) made").arg(replaces);
2189 KMessageBox::information(this, str, i18n("Replace")); 2189 KMessageBox::information(this, str, i18n("Replace"));
2190 return true; 2190 return true;
2191 } 2191 }
2192 2192
2193 // ask for continue 2193 // ask for continue
2194 if (!(s.flags & KateView::sfBackward)) { 2194 if (!(s.flags & KateView::sfBackward)) {
2195 // forward search 2195 // forward search
2196 str = i18n("%1 replacement(s) made.\n" 2196 str = i18n("%1 replacement(s) made.\n"
2197 "End of document reached.\n" 2197 "End of document reached.\n"
2198 "Continue from the beginning?").arg(replaces); 2198 "Continue from the beginning?").arg(replaces);
2199 query = KMessageBox::questionYesNo(this, str, i18n("Replace"), 2199 query = KMessageBox::questionYesNo(this, str, i18n("Replace"),
2200 i18n("Continue"), i18n("Stop")); 2200 i18n("Continue"), i18n("Stop"));
2201 } else { 2201 } else {
2202 // backward search 2202 // backward search
2203 str = i18n("%1 replacement(s) made.\n" 2203 str = i18n("%1 replacement(s) made.\n"
2204 "Beginning of document reached.\n" 2204 "Beginning of document reached.\n"
2205 "Continue from the end?").arg(replaces); 2205 "Continue from the end?").arg(replaces);
2206 query = KMessageBox::questionYesNo(this, str, i18n("Replace"), 2206 query = KMessageBox::questionYesNo(this, str, i18n("Replace"),
2207 i18n("Continue"), i18n("Stop")); 2207 i18n("Continue"), i18n("Stop"));
2208 } 2208 }
2209 replaces = 0; 2209 replaces = 0;
2210 continueSearch(s); 2210 continueSearch(s);
2211 return (query == KMessageBox::No); 2211 return (query == KMessageBox::No);
2212} 2212}
2213 2213
2214void KateView::replaceSlot() { 2214void KateView::replaceSlot() {
2215 doReplaceAction(replacePrompt->result(),true); 2215 doReplaceAction(replacePrompt->result(),true);
2216} 2216}
2217 2217
2218void KateView::installPopup(QPopupMenu *rmb_Menu) 2218void KateView::installPopup(QPopupMenu *rmb_Menu)
2219{ 2219{
2220 rmbMenu = rmb_Menu; 2220 rmbMenu = rmb_Menu;
2221} 2221}
2222 2222
2223void KateView::readConfig() 2223void KateView::readConfig()
2224{ 2224{
2225 KConfig *config = KGlobal::config(); 2225 KConfig *config = KGlobal::config();
2226 config->setGroup("Kate View"); 2226 config->setGroup("Kate View");
2227 2227
2228 searchFlags = config->readNumEntry("SearchFlags", KateView::sfPrompt); 2228 searchFlags = config->readNumEntry("SearchFlags", KateView::sfPrompt);
2229 configFlags = config->readNumEntry("ConfigFlags", configFlags) & ~KateView::cfMark; 2229 configFlags = config->readNumEntry("ConfigFlags", configFlags) & ~KateView::cfMark;
2230 2230
2231 config->sync(); 2231 config->sync();
2232} 2232}
2233 2233
2234void KateView::writeConfig() 2234void KateView::writeConfig()
2235{ 2235{
2236 KConfig *config = KGlobal::config(); 2236 KConfig *config = KGlobal::config();
2237 config->setGroup("Kate View"); 2237 config->setGroup("Kate View");
2238 2238
2239 config->writeEntry("SearchFlags",searchFlags); 2239 config->writeEntry("SearchFlags",searchFlags);
2240 config->writeEntry("ConfigFlags",configFlags); 2240 config->writeEntry("ConfigFlags",configFlags);
2241 2241
2242 config->sync(); 2242 config->sync();
2243} 2243}
2244 2244
2245void KateView::readSessionConfig(KConfig *config) 2245void KateView::readSessionConfig(KConfig *config)
2246{ 2246{
2247 PointStruc cursor; 2247 PointStruc cursor;
2248 2248
2249 myViewInternal->xPos = config->readNumEntry("XPos"); 2249 myViewInternal->xPos = config->readNumEntry("XPos");
2250 myViewInternal->yPos = config->readNumEntry("YPos"); 2250 myViewInternal->yPos = config->readNumEntry("YPos");
2251 cursor.x = config->readNumEntry("CursorX"); 2251 cursor.x = config->readNumEntry("CursorX");
2252 cursor.y = config->readNumEntry("CursorY"); 2252 cursor.y = config->readNumEntry("CursorY");
2253 myViewInternal->updateCursor(cursor); 2253 myViewInternal->updateCursor(cursor);
2254 myIconBorder = config->readBoolEntry("IconBorder on"); 2254 myIconBorder = config->readBoolEntry("IconBorder on");
2255 setIconBorder(myIconBorder); 2255 setIconBorder(myIconBorder);
2256} 2256}
2257 2257
2258void KateView::writeSessionConfig(KConfig *config) 2258void KateView::writeSessionConfig(KConfig *config)
2259{ 2259{
2260 config->writeEntry("XPos",myViewInternal->xPos); 2260 config->writeEntry("XPos",myViewInternal->xPos);
2261 config->writeEntry("YPos",myViewInternal->yPos); 2261 config->writeEntry("YPos",myViewInternal->yPos);
2262 config->writeEntry("CursorX",myViewInternal->cursor.x); 2262 config->writeEntry("CursorX",myViewInternal->cursor.x);
2263 config->writeEntry("CursorY",myViewInternal->cursor.y); 2263 config->writeEntry("CursorY",myViewInternal->cursor.y);
2264 config->writeEntry("IconBorder on", myIconBorder); 2264 config->writeEntry("IconBorder on", myIconBorder);
2265} 2265}
2266 2266
2267void KateView::configDialog() 2267void KateView::configDialog()
2268{ 2268{
2269 2269
2270#warning fixme 2270#warning fixme
2271 2271
2272#if 1 2272#if 1
2273 KDialogBase *kd = new KDialogBase(KDialogBase::IconList, 2273 KDialogBase *kd = new KDialogBase(KDialogBase::IconList,
2274 i18n("Configure Editor"), 2274 i18n("Configure Editor"),
2275 KDialogBase::Ok | KDialogBase::Cancel | 2275 KDialogBase::Ok | KDialogBase::Cancel |
2276 KDialogBase::Help , 2276 KDialogBase::Help ,
2277 KDialogBase::Ok, this, "tabdialog"); 2277 KDialogBase::Ok, this, "tabdialog");
2278 2278
2279 // color options 2279 // color options
2280 QFrame *page=kd->addPage(i18n("Colors")); 2280 QFrame *page=kd->addPage(i18n("Colors"));
2281 (new QVBoxLayout(page))->setAutoAdd(true); 2281 (new QVBoxLayout(page))->setAutoAdd(true);
2282 ColorConfig *colorConfig = new ColorConfig(page); 2282 ColorConfig *colorConfig = new ColorConfig(page);
2283 QColor* colors = getColors(); 2283 QColor* colors = getColors();
2284 colorConfig->setColors(colors); 2284 colorConfig->setColors(colors);
2285 2285
2286 page = kd->addPage(i18n("Fonts")); 2286 page = kd->addPage(i18n("Fonts"));
2287 (new QVBoxLayout(page))->setAutoAdd(true); 2287 (new QVBoxLayout(page))->setAutoAdd(true);
2288 2288
2289 FontConfig *fontConfig = new FontConfig(page); 2289 FontConfig *fontConfig = new FontConfig(page);
2290 fontConfig->setFont (myDoc->getFont()); 2290 fontConfig->setFont (myDoc->getFont());
2291 2291
2292 // indent options 2292 // indent options
2293 page=kd->addPage(i18n("Indent")); 2293 page=kd->addPage(i18n("Indent"));
2294 (new QVBoxLayout(page))->setAutoAdd(true); 2294 (new QVBoxLayout(page))->setAutoAdd(true);
2295 2295
2296 IndentConfigTab *indentConfig = new IndentConfigTab(page, this); 2296 IndentConfigTab *indentConfig = new IndentConfigTab(page, this);
2297 2297
2298 // select options 2298 // select options
2299 page=kd->addPage(i18n("Select")); 2299 page=kd->addPage(i18n("Select"));
2300 (new QVBoxLayout(page))->setAutoAdd(true); 2300 (new QVBoxLayout(page))->setAutoAdd(true);
2301 2301
2302 SelectConfigTab *selectConfig = new SelectConfigTab(page, this); 2302 SelectConfigTab *selectConfig = new SelectConfigTab(page, this);
2303 2303
2304 // edit options 2304 // edit options
2305 page=kd->addPage(i18n("Edit")); 2305 page=kd->addPage(i18n("Edit"));
2306 (new QVBoxLayout(page))->setAutoAdd(true); 2306 (new QVBoxLayout(page))->setAutoAdd(true);
2307 2307
2308 EditConfigTab *editConfig = new EditConfigTab(page, this); 2308 EditConfigTab *editConfig = new EditConfigTab(page, this);
2309 2309
2310 2310
2311 2311
2312 HighlightDialogPage *hlPage; 2312 HighlightDialogPage *hlPage;
2313 HlManager *hlManager; 2313 HlManager *hlManager;
2314 HlDataList hlDataList; 2314 HlDataList hlDataList;
2315 ItemStyleList defaultStyleList; 2315 ItemStyleList defaultStyleList;
2316 2316
2317 hlManager = HlManager::self(); 2317 hlManager = HlManager::self();
2318 2318
2319 defaultStyleList.setAutoDelete(true); 2319 defaultStyleList.setAutoDelete(true);
2320 hlManager->getDefaults(defaultStyleList); 2320 hlManager->getDefaults(defaultStyleList);
2321 2321
2322 hlDataList.setAutoDelete(true); 2322 hlDataList.setAutoDelete(true);
2323 //this gets the data from the KConfig object 2323 //this gets the data from the KConfig object
2324 hlManager->getHlDataList(hlDataList); 2324 hlManager->getHlDataList(hlDataList);
2325 2325
2326 page=kd->addPage(i18n("Highlighting")); 2326 page=kd->addPage(i18n("Highlighting"));
2327 (new QVBoxLayout(page))->setAutoAdd(true); 2327 (new QVBoxLayout(page))->setAutoAdd(true);
2328 2328
2329 hlPage = new HighlightDialogPage(hlManager, &defaultStyleList, &hlDataList, 0, page); 2329 hlPage = new HighlightDialogPage(hlManager, &defaultStyleList, &hlDataList, 0, page);
2330 kd->showMaximized(); 2330 kd->showMaximized();
2331 if (kd->exec()) { 2331 if (kd->exec()) {
2332 // color options 2332 // color options
2333 colorConfig->getColors(colors); 2333 colorConfig->getColors(colors);
2334 myDoc->setFont (fontConfig->getFont()); 2334 myDoc->setFont (fontConfig->getFont());
2335 2335
2336 applyColors(); 2336 applyColors();
2337 // indent options 2337 // indent options
2338 indentConfig->getData(this); 2338 indentConfig->getData(this);
2339 // select options 2339 // select options
2340 selectConfig->getData(this); 2340 selectConfig->getData(this);
2341 // edit options 2341 // edit options
2342 editConfig->getData(this); 2342 editConfig->getData(this);
2343 // spell checker 2343 // spell checker
2344 hlManager->setHlDataList(hlDataList); 2344 hlManager->setHlDataList(hlDataList);
2345 hlManager->setDefaults(defaultStyleList); 2345 hlManager->setDefaults(defaultStyleList);
2346 hlPage->saveData(); 2346 hlPage->saveData();
2347 } 2347 }
2348 2348
2349 delete kd; 2349// delete kd;
2350 2350
2351#endif 2351#endif
2352} 2352}
2353 2353
2354int KateView::getHl() { 2354int KateView::getHl() {
2355 return myDoc->highlightNum(); 2355 return myDoc->highlightNum();
2356} 2356}
2357 2357
2358void KateView::setDontChangeHlOnSave() 2358void KateView::setDontChangeHlOnSave()
2359{ 2359{
2360 myDoc->setDontChangeHlOnSave(); 2360 myDoc->setDontChangeHlOnSave();
2361} 2361}
2362 2362
2363void KateView::setHl(int n) { 2363void KateView::setHl(int n) {
2364 myDoc->setHighlight(n); 2364 myDoc->setHighlight(n);
2365 myDoc->setDontChangeHlOnSave(); 2365 myDoc->setDontChangeHlOnSave();
2366 myDoc->updateViews(); 2366 myDoc->updateViews();
2367} 2367}
2368 2368
2369int KateView::getEol() { 2369int KateView::getEol() {
2370 return myDoc->eolMode; 2370 return myDoc->eolMode;
2371} 2371}
2372 2372
2373void KateView::setEol(int eol) { 2373void KateView::setEol(int eol) {
2374 if (isReadOnly()) 2374 if (isReadOnly())
2375 return; 2375 return;
2376 2376
2377 myDoc->eolMode = eol; 2377 myDoc->eolMode = eol;
2378 myDoc->setModified(true); 2378 myDoc->setModified(true);
2379} 2379}
2380 2380
2381 2381
2382 2382
2383void KateView::paintEvent(QPaintEvent *e) { 2383void KateView::paintEvent(QPaintEvent *e) {
2384 int x, y; 2384 int x, y;
2385 2385
2386 QRect updateR = e->rect(); // update rectangle 2386 QRect updateR = e->rect(); // update rectangle
2387// debug("Update rect = ( %i, %i, %i, %i )", 2387// debug("Update rect = ( %i, %i, %i, %i )",
2388// updateR.x(),updateR.y(), updateR.width(), updateR.height() ); 2388// updateR.x(),updateR.y(), updateR.width(), updateR.height() );
2389 2389
2390 int ux1 = updateR.x(); 2390 int ux1 = updateR.x();
2391 int uy1 = updateR.y(); 2391 int uy1 = updateR.y();
2392 int ux2 = ux1 + updateR.width(); 2392 int ux2 = ux1 + updateR.width();
2393 int uy2 = uy1 + updateR.height(); 2393 int uy2 = uy1 + updateR.height();
2394 2394
2395 QPainter paint; 2395 QPainter paint;
2396 paint.begin(this); 2396 paint.begin(this);
2397 2397
2398 QColorGroup g = colorGroup(); 2398 QColorGroup g = colorGroup();
2399 x = width(); 2399 x = width();
2400 y = height(); 2400 y = height();
2401 2401
2402 paint.setPen(g.dark()); 2402 paint.setPen(g.dark());
2403 if (uy1 <= 0) paint.drawLine(0,0,x-2,0); 2403 if (uy1 <= 0) paint.drawLine(0,0,x-2,0);
2404 if (ux1 <= 0) paint.drawLine(0,1,0,y-2); 2404 if (ux1 <= 0) paint.drawLine(0,1,0,y-2);
2405 2405
2406 paint.setPen(black); 2406 paint.setPen(black);
2407 if (uy1 <= 1) paint.drawLine(1,1,x-3,1); 2407 if (uy1 <= 1) paint.drawLine(1,1,x-3,1);
2408 if (ux1 <= 1) paint.drawLine(1,2,1,y-3); 2408 if (ux1 <= 1) paint.drawLine(1,2,1,y-3);
2409 2409
2410 paint.setPen(g.midlight()); 2410 paint.setPen(g.midlight());
2411 if (uy2 >= y-1) paint.drawLine(1,y-2,x-3,y-2); 2411 if (uy2 >= y-1) paint.drawLine(1,y-2,x-3,y-2);
2412 if (ux2 >= x-1) paint.drawLine(x-2,1,x-2,y-2); 2412 if (ux2 >= x-1) paint.drawLine(x-2,1,x-2,y-2);
2413 2413
2414 paint.setPen(g.light()); 2414 paint.setPen(g.light());
2415 if (uy2 >= y) paint.drawLine(0,y-1,x-2,y-1); 2415 if (uy2 >= y) paint.drawLine(0,y-1,x-2,y-1);
2416 if (ux2 >= x) paint.drawLine(x-1,0,x-1,y-1); 2416 if (ux2 >= x) paint.drawLine(x-1,0,x-1,y-1);
2417 2417
2418 x -= 2 + 16; 2418 x -= 2 + 16;
2419 y -= 2 + 16; 2419 y -= 2 + 16;
2420 if (ux2 > x && uy2 > y) { 2420 if (ux2 > x && uy2 > y) {
2421 paint.fillRect(x,y,16,16,g.background()); 2421 paint.fillRect(x,y,16,16,g.background());
2422 } 2422 }
2423 paint.end(); 2423 paint.end();
2424} 2424}
2425 2425
2426void KateView::resizeEvent(QResizeEvent *) { 2426void KateView::resizeEvent(QResizeEvent *) {
2427 2427
2428// debug("Resize %d, %d",e->size().width(),e->size().height()); 2428// debug("Resize %d, %d",e->size().width(),e->size().height());
2429 2429
2430//myViewInternal->resize(width() -20, height() -20); 2430//myViewInternal->resize(width() -20, height() -20);
2431 myViewInternal->tagAll(); 2431 myViewInternal->tagAll();
2432 myViewInternal->updateView(0/*ufNoScroll*/); 2432 myViewInternal->updateView(0/*ufNoScroll*/);
2433} 2433}
2434 2434
2435 2435
2436// Applies a new pattern to the search context. 2436// Applies a new pattern to the search context.
2437void SConfig::setPattern(QString &newPattern) { 2437void SConfig::setPattern(QString &newPattern) {
2438 bool regExp = (flags & KateView::sfRegularExpression); 2438 bool regExp = (flags & KateView::sfRegularExpression);
2439 2439
2440 m_pattern = newPattern; 2440 m_pattern = newPattern;
2441 if (regExp) { 2441 if (regExp) {
2442 m_regExp.setCaseSensitive(flags & KateView::sfCaseSensitive); 2442 m_regExp.setCaseSensitive(flags & KateView::sfCaseSensitive);
2443 m_regExp.setPattern(m_pattern); 2443 m_regExp.setPattern(m_pattern);
2444 } 2444 }
2445} 2445}
2446 2446
2447// Applies the search context to the given string, and returns whether a match was found. If one is, 2447// Applies the search context to the given string, and returns whether a match was found. If one is,
2448// the length of the string matched is also returned. 2448// the length of the string matched is also returned.
2449int SConfig::search(QString &text, int index) { 2449int SConfig::search(QString &text, int index) {
2450 bool regExp = (flags & KateView::sfRegularExpression); 2450 bool regExp = (flags & KateView::sfRegularExpression);
2451 bool caseSensitive = (flags & KateView::sfCaseSensitive); 2451 bool caseSensitive = (flags & KateView::sfCaseSensitive);
2452 2452
2453 if (flags & KateView::sfBackward) { 2453 if (flags & KateView::sfBackward) {
2454 if (regExp) { 2454 if (regExp) {
2455 index = text.findRev(m_regExp, index); 2455 index = text.findRev(m_regExp, index);
2456 } 2456 }
2457 else { 2457 else {
2458 index = text.findRev(m_pattern, index, caseSensitive); 2458 index = text.findRev(m_pattern, index, caseSensitive);
2459 } 2459 }
2460 } 2460 }
2461 else { 2461 else {
2462 if (regExp) { 2462 if (regExp) {
2463 index = text.find(m_regExp, index); 2463 index = text.find(m_regExp, index);
2464 } 2464 }
2465 else { 2465 else {
2466 index = text.find(m_pattern, index, caseSensitive); 2466 index = text.find(m_pattern, index, caseSensitive);
2467 } 2467 }
2468 } 2468 }
2469 2469
2470 // Work out the matched length. 2470 // Work out the matched length.
2471 if (index != -1) 2471 if (index != -1)
2472 { 2472 {
2473 if (regExp) { 2473 if (regExp) {
2474 m_regExp.match(text, index, &matchedLength, false); 2474 m_regExp.match(text, index, &matchedLength, false);
2475 } 2475 }
2476 else { 2476 else {
2477 matchedLength = m_pattern.length(); 2477 matchedLength = m_pattern.length();
2478 } 2478 }
2479 } 2479 }
2480 return index; 2480 return index;
2481} 2481}
2482 2482
2483void KateView::setActive (bool b) 2483void KateView::setActive (bool b)
2484{ 2484{
2485 active = b; 2485 active = b;
2486} 2486}
2487 2487
2488bool KateView::isActive () 2488bool KateView::isActive ()
2489{ 2489{
2490 return active; 2490 return active;
2491} 2491}
2492 2492
2493void KateView::setFocus () 2493void KateView::setFocus ()
2494{ 2494{
2495 QWidget::setFocus (); 2495 QWidget::setFocus ();
2496 2496
2497 emit gotFocus (this); 2497 emit gotFocus (this);
2498} 2498}
2499 2499
2500bool KateView::eventFilter (QObject *object, QEvent *event) 2500bool KateView::eventFilter (QObject *object, QEvent *event)
2501{ 2501{
2502 2502
2503 if ( (event->type() == QEvent::FocusIn) ) 2503 if ( (event->type() == QEvent::FocusIn) )
2504 emit gotFocus (this); 2504 emit gotFocus (this);
2505 2505
2506 if ( (event->type() == QEvent::KeyPress) ) 2506 if ( (event->type() == QEvent::KeyPress) )
2507 { 2507 {
2508 QKeyEvent * ke=(QKeyEvent *)event; 2508 QKeyEvent * ke=(QKeyEvent *)event;
2509 2509
2510 if ((ke->key()==Qt::Key_Tab) || (ke->key()==Qt::Key_BackTab)) 2510 if ((ke->key()==Qt::Key_Tab) || (ke->key()==Qt::Key_BackTab))
2511 { 2511 {
2512 myViewInternal->keyPressEvent(ke); 2512 myViewInternal->keyPressEvent(ke);
2513 return true; 2513 return true;
2514 } 2514 }
2515 } 2515 }
2516 return QWidget::eventFilter (object, event); 2516 return QWidget::eventFilter (object, event);
2517} 2517}
2518 2518
2519void KateView::findAgain (bool back) 2519void KateView::findAgain (bool back)
2520{ 2520{
2521 bool b= (searchFlags & sfBackward) > 0; 2521 bool b= (searchFlags & sfBackward) > 0;
2522 initSearch(s, (searchFlags & ((b==back)?~sfBackward:~0) & ~sfFromBeginning) // clear flag for forward searching 2522 initSearch(s, (searchFlags & ((b==back)?~sfBackward:~0) & ~sfFromBeginning) // clear flag for forward searching
2523 | sfPrompt | sfAgain | ((b!=back)?sfBackward:0) ); 2523 | sfPrompt | sfAgain | ((b!=back)?sfBackward:0) );
2524 if (s.flags & sfReplace) 2524 if (s.flags & sfReplace)
2525 replaceAgain(); 2525 replaceAgain();
2526 else 2526 else
2527 KateView::findAgain(s); 2527 KateView::findAgain(s);
2528} 2528}
2529 2529
2530void KateView::slotEditCommand () 2530void KateView::slotEditCommand ()
2531{ 2531{
2532#warning fixme 2532#warning fixme
2533/* 2533/*
2534 bool ok; 2534 bool ok;
2535 QString cmd = KLineEditDlg::getText("Editing Command", "", &ok, this); 2535 QString cmd = KLineEditDlg::getText("Editing Command", "", &ok, this);
2536 2536
2537 if (ok) 2537 if (ok)
2538 myDoc->cmd()->execCmd (cmd, this);*/ 2538 myDoc->cmd()->execCmd (cmd, this);*/
2539} 2539}
2540 2540
2541void KateView::setIconBorder (bool enable) 2541void KateView::setIconBorder (bool enable)
2542{ 2542{
2543 myIconBorder = enable; 2543 myIconBorder = enable;
2544 2544
2545 if (myIconBorder) 2545 if (myIconBorder)
2546 { 2546 {
2547 myViewInternal->move(myViewInternal->iconBorderWidth+2, 2); 2547 myViewInternal->move(myViewInternal->iconBorderWidth+2, 2);
2548 myViewInternal->leftBorder->show(); 2548 myViewInternal->leftBorder->show();
2549 } 2549 }
2550 else 2550 else
2551 { 2551 {
2552 myViewInternal->leftBorder->hide(); 2552 myViewInternal->leftBorder->hide();
2553 myViewInternal->move(2, 2); 2553 myViewInternal->move(2, 2);
2554 } 2554 }
2555} 2555}
2556 2556
2557void KateView::toggleIconBorder () 2557void KateView::toggleIconBorder ()
2558{ 2558{
2559 setIconBorder (!myIconBorder); 2559 setIconBorder (!myIconBorder);
2560} 2560}
2561 2561
2562void KateView::gotoMark (Kate::Mark *mark) 2562void KateView::gotoMark (Kate::Mark *mark)
2563{ 2563{
2564 PointStruc cursor; 2564 PointStruc cursor;
2565 2565
2566 cursor.x = 0; 2566 cursor.x = 0;
2567 cursor.y = mark->line; 2567 cursor.y = mark->line;
2568 myDoc->needPreHighlight(cursor.y); 2568 myDoc->needPreHighlight(cursor.y);
2569 myViewInternal->updateCursor(cursor); 2569 myViewInternal->updateCursor(cursor);
2570 myViewInternal->center(); 2570 myViewInternal->center();
2571 myViewInternal->updateView(KateView::ufUpdateOnScroll); 2571 myViewInternal->updateView(KateView::ufUpdateOnScroll);
2572 myDoc->updateViews(this); 2572 myDoc->updateViews(this);
2573} 2573}
2574 2574
2575void KateView::toggleBookmark () 2575void KateView::toggleBookmark ()
2576{ 2576{
2577 TextLine::Ptr line = myDoc->getTextLine (currentLine()); 2577 TextLine::Ptr line = myDoc->getTextLine (currentLine());
2578 2578
2579 if (line->mark()&KateDocument::Bookmark) 2579 if (line->mark()&KateDocument::Bookmark)
2580 line->delMark(KateDocument::Bookmark); 2580 line->delMark(KateDocument::Bookmark);
2581 else 2581 else
2582 line->addMark(KateDocument::Bookmark); 2582 line->addMark(KateDocument::Bookmark);
2583 2583
2584 myDoc->tagLines (currentLine(), currentLine()); 2584 myDoc->tagLines (currentLine(), currentLine());
2585 myDoc->updateViews(); 2585 myDoc->updateViews();
2586} 2586}
2587 2587
2588void KateView::clearBookmarks() 2588void KateView::clearBookmarks()
2589{ 2589{
2590 QList<Kate::Mark> list = myDoc->marks(); 2590 QList<Kate::Mark> list = myDoc->marks();
2591 for (int i=0; (uint) i < list.count(); i++) 2591 for (int i=0; (uint) i < list.count(); i++)
2592 { 2592 {
2593 if (list.at(i)->type&KateDocument::Bookmark) 2593 if (list.at(i)->type&KateDocument::Bookmark)
2594 { 2594 {
2595 myDoc->getTextLine(list.at(i)->line)->delMark(KateDocument::Bookmark); 2595 myDoc->getTextLine(list.at(i)->line)->delMark(KateDocument::Bookmark);
2596 myDoc->tagLines(list.at(i)->line, list.at(i)->line); 2596 myDoc->tagLines(list.at(i)->line, list.at(i)->line);
2597 } 2597 }
2598 } 2598 }
2599 2599
2600 myDoc->updateViews(); 2600 myDoc->updateViews();
2601} 2601}
2602 2602
2603void KateView::bookmarkMenuAboutToShow() 2603void KateView::bookmarkMenuAboutToShow()
2604{ 2604{
2605#warning fixme 2605#warning fixme
2606#if 0 2606#if 0
2607 bookmarkMenu->popupMenu()->clear (); 2607 bookmarkMenu->popupMenu()->clear ();
2608 bookmarkToggle->plug (bookmarkMenu->popupMenu()); 2608 bookmarkToggle->plug (bookmarkMenu->popupMenu());
2609 bookmarkClear->plug (bookmarkMenu->popupMenu()); 2609 bookmarkClear->plug (bookmarkMenu->popupMenu());
2610 bookmarkMenu->popupMenu()->insertSeparator (); 2610 bookmarkMenu->popupMenu()->insertSeparator ();
2611 2611
2612 list = myDoc->marks(); 2612 list = myDoc->marks();
2613 for (int i=0; (uint) i < list.count(); i++) 2613 for (int i=0; (uint) i < list.count(); i++)
2614 { 2614 {
2615 if (list.at(i)->type&KateDocument::Bookmark) 2615 if (list.at(i)->type&KateDocument::Bookmark)
2616 { 2616 {
2617 QString bText = textLine(list.at(i)->line); 2617 QString bText = textLine(list.at(i)->line);
2618 bText.truncate(32); 2618 bText.truncate(32);
2619 bText.append ("..."); 2619 bText.append ("...");
2620 bookmarkMenu->popupMenu()->insertItem ( QString("%1 - \"%2\"").arg(list.at(i)->line).arg(bText), this, SLOT (gotoBookmark(int)), 0, i ); 2620 bookmarkMenu->popupMenu()->insertItem ( QString("%1 - \"%2\"").arg(list.at(i)->line).arg(bText), this, SLOT (gotoBookmark(int)), 0, i );
2621 } 2621 }
2622 } 2622 }
2623#endif 2623#endif
2624} 2624}
2625 2625
2626void KateView::gotoBookmark (int n) 2626void KateView::gotoBookmark (int n)
2627{ 2627{
2628 gotoMark (list.at(n)); 2628 gotoMark (list.at(n));
2629} 2629}
2630 2630
2631int KateView::getHlCount () 2631int KateView::getHlCount ()
2632{ 2632{
2633 return HlManager::self()->highlights(); 2633 return HlManager::self()->highlights();
2634} 2634}
2635 2635
2636QString KateView::getHlName (int z) 2636QString KateView::getHlName (int z)
2637{ 2637{
2638 return HlManager::self()->hlName(z); 2638 return HlManager::self()->hlName(z);
2639} 2639}
2640 2640
2641QString KateView::getHlSection (int z) 2641QString KateView::getHlSection (int z)
2642{ 2642{
2643 return HlManager::self()->hlSection (z); 2643 return HlManager::self()->hlSection (z);
2644} 2644}
2645 2645
2646void KateView::slotIncFontSizes () 2646void KateView::slotIncFontSizes ()
2647{ 2647{
2648 QFont font = myDoc->getFont(); 2648 QFont font = myDoc->getFont();
2649 font.setPointSize (font.pointSize()+2); 2649 font.setPointSize (font.pointSize()+2);
2650 myDoc->setFont (font); 2650 myDoc->setFont (font);
2651} 2651}
2652 2652
2653void KateView::slotDecFontSizes () 2653void KateView::slotDecFontSizes ()
2654{ 2654{
2655 QFont font = myDoc->getFont(); 2655 QFont font = myDoc->getFont();
2656 font.setPointSize (font.pointSize()-2); 2656 font.setPointSize (font.pointSize()-2);
2657 myDoc->setFont (font); 2657 myDoc->setFont (font);
2658} 2658}
2659 2659
2660const char*bookmark_xpm[]={ 2660const char*bookmark_xpm[]={
2661"12 16 4 1", 2661"12 16 4 1",
2662"b c #808080", 2662"b c #808080",
2663"a c #000080", 2663"a c #000080",
2664"# c #0000ff", 2664"# c #0000ff",
2665". c None", 2665". c None",
2666"............", 2666"............",
2667"............", 2667"............",
2668"........###.", 2668"........###.",
2669".......#...a", 2669".......#...a",
2670"......#.##.a", 2670"......#.##.a",
2671".....#.#..aa", 2671".....#.#..aa",
2672"....#.#...a.", 2672"....#.#...a.",
2673"...#.#.a.a..", 2673"...#.#.a.a..",
2674"..#.#.a.a...", 2674"..#.#.a.a...",
2675".#.#.a.a....", 2675".#.#.a.a....",
2676"#.#.a.a.....", 2676"#.#.a.a.....",
2677"#.#a.a...bbb", 2677"#.#a.a...bbb",
2678"#...a..bbb..", 2678"#...a..bbb..",
2679".aaa.bbb....", 2679".aaa.bbb....",
2680"............", 2680"............",
2681"............"}; 2681"............"};
2682 2682
2683const char* breakpoint_xpm[]={ 2683const char* breakpoint_xpm[]={
2684"11 16 6 1", 2684"11 16 6 1",
2685"c c #c6c6c6", 2685"c c #c6c6c6",
2686". c None", 2686". c None",
2687"# c #000000", 2687"# c #000000",
2688"d c #840000", 2688"d c #840000",
2689"a c #ffffff", 2689"a c #ffffff",
2690"b c #ff0000", 2690"b c #ff0000",
2691"...........", 2691"...........",
2692"...........", 2692"...........",
2693"...#####...", 2693"...#####...",
2694"..#aaaaa#..", 2694"..#aaaaa#..",
2695".#abbbbbb#.", 2695".#abbbbbb#.",
2696"#abbbbbbbb#", 2696"#abbbbbbbb#",
2697"#abcacacbd#", 2697"#abcacacbd#",
2698"#abbbbbbbb#", 2698"#abbbbbbbb#",
2699"#abcacacbd#", 2699"#abcacacbd#",
2700"#abbbbbbbb#", 2700"#abbbbbbbb#",
2701".#bbbbbbb#.", 2701".#bbbbbbb#.",
2702"..#bdbdb#..", 2702"..#bdbdb#..",
2703"...#####...", 2703"...#####...",
2704"...........", 2704"...........",
2705"...........", 2705"...........",
2706"..........."}; 2706"..........."};
2707 2707
2708const char*breakpoint_bl_xpm[]={ 2708const char*breakpoint_bl_xpm[]={
2709"11 16 7 1", 2709"11 16 7 1",
2710"a c #c0c0ff", 2710"a c #c0c0ff",
2711"# c #000000", 2711"# c #000000",
2712"c c #0000c0", 2712"c c #0000c0",
2713"e c #0000ff", 2713"e c #0000ff",
2714"b c #dcdcdc", 2714"b c #dcdcdc",
2715"d c #ffffff", 2715"d c #ffffff",
2716". c None", 2716". c None",
2717"...........", 2717"...........",
2718"...........", 2718"...........",
2719"...#####...", 2719"...#####...",
2720"..#ababa#..", 2720"..#ababa#..",
2721".#bcccccc#.", 2721".#bcccccc#.",
2722"#acccccccc#", 2722"#acccccccc#",
2723"#bcadadace#", 2723"#bcadadace#",
2724"#acccccccc#", 2724"#acccccccc#",
2725"#bcadadace#", 2725"#bcadadace#",
2726"#acccccccc#", 2726"#acccccccc#",
2727".#ccccccc#.", 2727".#ccccccc#.",
2728"..#cecec#..", 2728"..#cecec#..",
2729"...#####...", 2729"...#####...",
2730"...........", 2730"...........",
2731"...........", 2731"...........",
2732"..........."}; 2732"..........."};
2733 2733
2734const char*breakpoint_gr_xpm[]={ 2734const char*breakpoint_gr_xpm[]={
2735"11 16 6 1", 2735"11 16 6 1",
2736"c c #c6c6c6", 2736"c c #c6c6c6",
2737"d c #2c2c2c", 2737"d c #2c2c2c",
2738"# c #000000", 2738"# c #000000",
2739". c None", 2739". c None",
2740"a c #ffffff", 2740"a c #ffffff",
2741"b c #555555", 2741"b c #555555",
2742"...........", 2742"...........",
2743"...........", 2743"...........",
2744"...#####...", 2744"...#####...",
2745"..#aaaaa#..", 2745"..#aaaaa#..",
2746".#abbbbbb#.", 2746".#abbbbbb#.",
2747"#abbbbbbbb#", 2747"#abbbbbbbb#",
2748"#abcacacbd#", 2748"#abcacacbd#",
2749"#abbbbbbbb#", 2749"#abbbbbbbb#",
2750"#abcacacbd#", 2750"#abcacacbd#",
2751"#abbbbbbbb#", 2751"#abbbbbbbb#",
2752".#bbbbbbb#.", 2752".#bbbbbbb#.",
2753"..#bdbdb#..", 2753"..#bdbdb#..",
2754"...#####...", 2754"...#####...",
2755"...........", 2755"...........",
2756"...........", 2756"...........",
2757"..........."}; 2757"..........."};
2758 2758
2759const char*ddd_xpm[]={ 2759const char*ddd_xpm[]={
2760"11 16 4 1", 2760"11 16 4 1",
2761"a c #00ff00", 2761"a c #00ff00",
2762"b c #000000", 2762"b c #000000",
2763". c None", 2763". c None",
2764"# c #00c000", 2764"# c #00c000",
2765"...........", 2765"...........",
2766"...........", 2766"...........",
2767"...........", 2767"...........",
2768"#a.........", 2768"#a.........",
2769"#aaa.......", 2769"#aaa.......",
2770"#aaaaa.....", 2770"#aaaaa.....",
2771"#aaaaaaa...", 2771"#aaaaaaa...",
2772"#aaaaaaaaa.", 2772"#aaaaaaaaa.",
2773"#aaaaaaa#b.", 2773"#aaaaaaa#b.",
2774"#aaaaa#b...", 2774"#aaaaa#b...",
2775"#aaa#b.....", 2775"#aaa#b.....",
2776"#a#b.......", 2776"#a#b.......",
2777"#b.........", 2777"#b.........",
2778"...........", 2778"...........",
2779"...........", 2779"...........",
2780"..........."}; 2780"..........."};
2781 2781
2782 2782
2783 2783
2784KateIconBorder::KateIconBorder(KateView *view, KateViewInternal *internalView) 2784KateIconBorder::KateIconBorder(KateView *view, KateViewInternal *internalView)
2785 : QWidget(view), myView(view), myInternalView(internalView) 2785 : QWidget(view), myView(view), myInternalView(internalView)
2786{ 2786{
2787 lmbSetsBreakpoints = true; 2787 lmbSetsBreakpoints = true;
2788} 2788}
2789 2789
2790KateIconBorder::~KateIconBorder() 2790KateIconBorder::~KateIconBorder()
2791{ 2791{
2792} 2792}
2793 2793
2794void KateIconBorder::paintLine(int i) 2794void KateIconBorder::paintLine(int i)
2795{ 2795{
2796 if (!myView->myIconBorder) return; 2796 if (!myView->myIconBorder) return;
2797 2797
2798 QPainter p(this); 2798 QPainter p(this);
2799 2799
2800 int fontHeight = myView->doc()->fontHeight; 2800 int fontHeight = myView->doc()->fontHeight;
2801 int y = i*fontHeight - myInternalView->yPos; 2801 int y = i*fontHeight - myInternalView->yPos;
2802 p.fillRect(0, y, myInternalView->iconBorderWidth-2, fontHeight, colorGroup().background()); 2802 p.fillRect(0, y, myInternalView->iconBorderWidth-2, fontHeight, colorGroup().background());
2803 p.setPen(white); 2803 p.setPen(white);
2804 p.drawLine(myInternalView->iconBorderWidth-2, y, myInternalView->iconBorderWidth-2, y + fontHeight); 2804 p.drawLine(myInternalView->iconBorderWidth-2, y, myInternalView->iconBorderWidth-2, y + fontHeight);
2805 p.setPen(QColor(colorGroup().background()).dark()); 2805 p.setPen(QColor(colorGroup().background()).dark());
2806 p.drawLine(myInternalView->iconBorderWidth-1, y, myInternalView->iconBorderWidth-1, y + fontHeight); 2806 p.drawLine(myInternalView->iconBorderWidth-1, y, myInternalView->iconBorderWidth-1, y + fontHeight);
2807 2807
2808 TextLine *line = myView->doc()->getTextLine(i); 2808 TextLine *line = myView->doc()->getTextLine(i);
2809 if (!line) 2809 if (!line)
2810 return; 2810 return;
2811 2811
2812 if (line->mark()&KateDocument::Bookmark) 2812 if (line->mark()&KateDocument::Bookmark)
2813 p.drawPixmap(2, y, QPixmap(bookmark_xpm)); /* 2813 p.drawPixmap(2, y, QPixmap(bookmark_xpm)); /*
2814 if (line && (line->breakpointId() != -1)) { 2814 if (line && (line->breakpointId() != -1)) {
2815 if (!line->breakpointEnabled()) 2815 if (!line->breakpointEnabled())
2816 p.drawPixmap(2, y, QPixmap(breakpoint_gr_xpm)); 2816 p.drawPixmap(2, y, QPixmap(breakpoint_gr_xpm));
2817 else if (line->breakpointPending()) 2817 else if (line->breakpointPending())
2818 p.drawPixmap(2, y, QPixmap(breakpoint_bl_xpm)); 2818 p.drawPixmap(2, y, QPixmap(breakpoint_bl_xpm));
2819 else 2819 else
2820 p.drawPixmap(2, y, QPixmap(breakpoint_xpm)); 2820 p.drawPixmap(2, y, QPixmap(breakpoint_xpm));
2821 } 2821 }
2822 if (line->isExecutionPoint()) 2822 if (line->isExecutionPoint())
2823 p.drawPixmap(2, y, QPixmap(ddd_xpm)); */ 2823 p.drawPixmap(2, y, QPixmap(ddd_xpm)); */
2824} 2824}
2825 2825
2826 2826
2827void KateIconBorder::paintEvent(QPaintEvent* e) 2827void KateIconBorder::paintEvent(QPaintEvent* e)
2828{ 2828{
2829 if (!myView->myIconBorder) return; 2829 if (!myView->myIconBorder) return;
2830 2830
2831 int lineStart = 0; 2831 int lineStart = 0;
2832 int lineEnd = 0; 2832 int lineEnd = 0;
2833 2833
2834 QRect updateR = e->rect(); 2834 QRect updateR = e->rect();
2835 2835
2836 KateDocument *doc = myView->doc(); 2836 KateDocument *doc = myView->doc();
2837 int h = doc->fontHeight; 2837 int h = doc->fontHeight;
2838 int yPos = myInternalView->yPos; 2838 int yPos = myInternalView->yPos;
2839 if (h) { 2839 if (h) {
2840 lineStart = (yPos + updateR.y()) / h; 2840 lineStart = (yPos + updateR.y()) / h;
2841 lineEnd = QMAX((yPos + updateR.y() + updateR.height()) / h, (int)doc->numLines()); 2841 lineEnd = QMAX((yPos + updateR.y() + updateR.height()) / h, (int)doc->numLines());
2842 } 2842 }
2843 2843
2844 for(int i = lineStart; i <= lineEnd; ++i) 2844 for(int i = lineStart; i <= lineEnd; ++i)
2845 paintLine(i); 2845 paintLine(i);
2846} 2846}
2847 2847
2848 2848
2849void KateIconBorder::mousePressEvent(QMouseEvent* e) 2849void KateIconBorder::mousePressEvent(QMouseEvent* e)
2850{ 2850{
2851 myInternalView->placeCursor( 0, e->y(), 0 ); 2851 myInternalView->placeCursor( 0, e->y(), 0 );
2852 2852
2853 KateDocument *doc = myView->doc(); 2853 KateDocument *doc = myView->doc();
2854 int cursorOnLine = (e->y() + myInternalView->yPos) / doc->fontHeight; 2854 int cursorOnLine = (e->y() + myInternalView->yPos) / doc->fontHeight;
2855 TextLine *line = doc->getTextLine(cursorOnLine); 2855 TextLine *line = doc->getTextLine(cursorOnLine);
2856 2856
2857 switch (e->button()) { 2857 switch (e->button()) {
2858 case LeftButton: 2858 case LeftButton:
2859 if (!line) 2859 if (!line)
2860 break; 2860 break;
2861 else 2861 else
diff --git a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp
index a311042..6a19e01 100644
--- a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp
+++ b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp
@@ -1,556 +1,573 @@
1/*************************************************************************** 1/***************************************************************************
2 kateviewdialog.cpp - description 2 kateviewdialog.cpp - description
3 ------------------- 3 -------------------
4 copyright : (C) 2001 by The Kate Team 4 copyright : (C) 2001 by The Kate Team
5 (C) 2002 by Joseph Wenninger 5 (C) 2002 by Joseph Wenninger
6 email : kwrite-devel@kde.org 6 email : kwrite-devel@kde.org
7 jowenn@kde.org 7 jowenn@kde.org
8 8
9 ***************************************************************************/ 9 ***************************************************************************/
10 10
11/*************************************************************************** 11/***************************************************************************
12 * * 12 * *
13 * This program is free software; you can redistribute it and/or modify * 13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by * 14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or * 15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. * 16 * (at your option) any later version. *
17 * * 17 * *
18 ***************************************************************************/ 18 ***************************************************************************/
19// Dialogs 19// Dialogs
20 20
21#include <stdio.h> 21#include <stdio.h>
22#include <stdlib.h> 22#include <stdlib.h>
23 23
24#include <qgrid.h> 24#include <qgrid.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlistbox.h> 27#include <qlistbox.h>
28#include <qspinbox.h> 28#include <qspinbox.h>
29#include <qcombobox.h> 29#include <qcombobox.h>
30#include <qgroupbox.h> 30#include <qgroupbox.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qcheckbox.h> 32#include <qcheckbox.h>
33#include <qcollection.h> 33#include <qcollection.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#include <qobjectlist.h> 35#include <qobjectlist.h>
36#include <qradiobutton.h> 36#include <qradiobutton.h>
37#include <qwhatsthis.h> 37#include <qwhatsthis.h>
38#include <qstringlist.h> 38#include <qstringlist.h>
39#include <klocale.h> 39#include <klocale.h>
40#include <kcolorbtn.h> 40#include <kcolorbtn.h>
41#include <qcombobox.h> 41#include <qcombobox.h>
42#include <kglobal.h> 42#include <kglobal.h>
43#include <qvbox.h> 43#include <qvbox.h>
44#include <qspinbox.h> 44#include <qspinbox.h>
45#include <kfontdialog.h> 45#include <kfontdialog.h>
46 46
47#include "../document/katedocument.h" 47#include "../document/katedocument.h"
48#include "kateviewdialog.h" 48#include "kateviewdialog.h"
49#include <opie/ofontselector.h>
50
49 51
50SearchDialog::SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags ) 52SearchDialog::SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags )
51 : KDialogBase( parent, 0L, true, i18n( "Find Text" ), Ok | Cancel, Ok ) 53 : KDialogBase( parent, 0L, true, i18n( "Find Text" ), Ok | Cancel, Ok )
52 , m_replace( 0L ) 54 , m_replace( 0L )
53{ 55{
54 QWidget *page = new QWidget( this ); 56 QWidget *page = new QWidget( this );
55 setMainWidget( page ); 57 setMainWidget( page );
56 58
57 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); 59 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
58 60
59 m_search = new QComboBox( true, page ); 61 m_search = new QComboBox( true, page );
60 m_search->insertStringList( searchFor ); 62 m_search->insertStringList( searchFor );
61 m_search->setMinimumWidth( m_search->sizeHint().width() ); 63 m_search->setMinimumWidth( m_search->sizeHint().width() );
62 m_search->lineEdit()->selectAll(); 64 m_search->lineEdit()->selectAll();
63 QLabel *label = new QLabel( m_search, i18n( "&Text To Find:" ), page ); 65 QLabel *label = new QLabel( m_search, i18n( "&Text To Find:" ), page );
64 m_optRegExp = new QCheckBox( i18n( "Regular Expression" ), page ); 66 m_optRegExp = new QCheckBox( i18n( "Regular Expression" ), page );
65 topLayout->addWidget( label ); 67 topLayout->addWidget( label );
66 topLayout->addWidget( m_search ); 68 topLayout->addWidget( m_search );
67 topLayout->addWidget( m_optRegExp ); 69 topLayout->addWidget( m_optRegExp );
68 70
69 if( flags & KateView::sfReplace ) 71 if( flags & KateView::sfReplace )
70 { 72 {
71 // make it a replace dialog 73 // make it a replace dialog
72 setCaption( i18n( "Replace Text" ) ); 74 setCaption( i18n( "Replace Text" ) );
73 m_replace = new QComboBox( true, page ); 75 m_replace = new QComboBox( true, page );
74 m_replace->insertStringList( replaceWith ); 76 m_replace->insertStringList( replaceWith );
75 m_replace->setMinimumWidth( m_search->sizeHint().width() ); 77 m_replace->setMinimumWidth( m_search->sizeHint().width() );
76 label = new QLabel( m_replace, i18n( "&Replace With:" ), page ); 78 label = new QLabel( m_replace, i18n( "&Replace With:" ), page );
77 //m_optPlaceholders = new QCheckBox( i18n( "&Use Placeholders" ), page ); 79 //m_optPlaceholders = new QCheckBox( i18n( "&Use Placeholders" ), page );
78 topLayout->addWidget( label ); 80 topLayout->addWidget( label );
79 topLayout->addWidget( m_replace ); 81 topLayout->addWidget( m_replace );
80 //topLayout->addWidget( m_optPlaceholders ); 82 //topLayout->addWidget( m_optPlaceholders );
81 } 83 }
82 84
83 QGroupBox *group = new QGroupBox( i18n( "Options" ), page ); 85 QGroupBox *group = new QGroupBox( i18n( "Options" ), page );
84 topLayout->addWidget( group, 10 ); 86 topLayout->addWidget( group, 10 );
85 87
86 QGridLayout *gbox = new QGridLayout( group, 5, 2, spacingHint() ); 88 QGridLayout *gbox = new QGridLayout( group, 5, 2, spacingHint() );
87 gbox->addRowSpacing( 0, fontMetrics().lineSpacing() ); 89 gbox->addRowSpacing( 0, fontMetrics().lineSpacing() );
88 gbox->setRowStretch( 4, 10 ); 90 gbox->setRowStretch( 4, 10 );
89 91
90 m_opt1 = new QCheckBox( i18n( "C&ase Sensitive" ), group ); 92 m_opt1 = new QCheckBox( i18n( "C&ase Sensitive" ), group );
91 gbox->addWidget( m_opt1, 1, 0 ); 93 gbox->addWidget( m_opt1, 1, 0 );
92 94
93 m_opt2 = new QCheckBox(i18n("&Whole Words Only" ), group ); 95 m_opt2 = new QCheckBox(i18n("&Whole Words Only" ), group );
94 gbox->addWidget( m_opt2, 2, 0 ); 96 gbox->addWidget( m_opt2, 2, 0 );
95 97
96 m_opt3 = new QCheckBox(i18n("&From Beginning" ), group ); 98 m_opt3 = new QCheckBox(i18n("&From Beginning" ), group );
97 gbox->addWidget( m_opt3, 3, 0 ); 99 gbox->addWidget( m_opt3, 3, 0 );
98 100
99 m_opt4 = new QCheckBox(i18n("Find &Backwards" ), group ); 101 m_opt4 = new QCheckBox(i18n("Find &Backwards" ), group );
100 gbox->addWidget( m_opt4, 1, 1 ); 102 gbox->addWidget( m_opt4, 1, 1 );
101 103
102 m_opt5 = new QCheckBox(i18n("&Selected Text" ), group ); 104 m_opt5 = new QCheckBox(i18n("&Selected Text" ), group );
103 gbox->addWidget( m_opt5, 2, 1 ); 105 gbox->addWidget( m_opt5, 2, 1 );
104 106
105 m_opt1->setChecked( flags & KateView::sfCaseSensitive ); 107 m_opt1->setChecked( flags & KateView::sfCaseSensitive );
106 m_opt2->setChecked( flags & KateView::sfWholeWords ); 108 m_opt2->setChecked( flags & KateView::sfWholeWords );
107 m_opt3->setChecked( flags & KateView::sfFromBeginning ); 109 m_opt3->setChecked( flags & KateView::sfFromBeginning );
108 m_optRegExp->setChecked( flags & KateView::sfRegularExpression ); 110 m_optRegExp->setChecked( flags & KateView::sfRegularExpression );
109 m_opt4->setChecked( flags & KateView::sfBackward ); 111 m_opt4->setChecked( flags & KateView::sfBackward );
110 m_opt5->setChecked( flags & KateView::sfSelected ); 112 m_opt5->setChecked( flags & KateView::sfSelected );
111 113
112 if( m_replace ) 114 if( m_replace )
113 { 115 {
114 m_opt6 = new QCheckBox( i18n( "&Prompt On Replace" ), group ); 116 m_opt6 = new QCheckBox( i18n( "&Prompt On Replace" ), group );
115 m_opt6->setChecked( flags & KateView::sfPrompt ); 117 m_opt6->setChecked( flags & KateView::sfPrompt );
116 gbox->addWidget( m_opt6, 3, 1 ); 118 gbox->addWidget( m_opt6, 3, 1 );
117 } 119 }
118 120
119 m_search->setFocus(); 121 m_search->setFocus();
120} 122}
121 123
122QString SearchDialog::getSearchFor() 124QString SearchDialog::getSearchFor()
123{ 125{
124 return m_search->currentText(); 126 return m_search->currentText();
125} 127}
126 128
127QString SearchDialog::getReplaceWith() 129QString SearchDialog::getReplaceWith()
128{ 130{
129 return m_replace->currentText(); 131 return m_replace->currentText();
130} 132}
131 133
132int SearchDialog::getFlags() 134int SearchDialog::getFlags()
133{ 135{
134 int flags = 0; 136 int flags = 0;
135 137
136 if( m_opt1->isChecked() ) flags |= KateView::sfCaseSensitive; 138 if( m_opt1->isChecked() ) flags |= KateView::sfCaseSensitive;
137 if( m_opt2->isChecked() ) flags |= KateView::sfWholeWords; 139 if( m_opt2->isChecked() ) flags |= KateView::sfWholeWords;
138 if( m_opt3->isChecked() ) flags |= KateView::sfFromBeginning; 140 if( m_opt3->isChecked() ) flags |= KateView::sfFromBeginning;
139 if( m_opt4->isChecked() ) flags |= KateView::sfBackward; 141 if( m_opt4->isChecked() ) flags |= KateView::sfBackward;
140 if( m_opt5->isChecked() ) flags |= KateView::sfSelected; 142 if( m_opt5->isChecked() ) flags |= KateView::sfSelected;
141 if( m_optRegExp->isChecked() ) flags |= KateView::sfRegularExpression; 143 if( m_optRegExp->isChecked() ) flags |= KateView::sfRegularExpression;
142 if( m_replace ) 144 if( m_replace )
143 { 145 {
144 if( m_opt6->isChecked() ) 146 if( m_opt6->isChecked() )
145 flags |= KateView::sfPrompt; 147 flags |= KateView::sfPrompt;
146 148
147 flags |= KateView::sfReplace; 149 flags |= KateView::sfReplace;
148 } 150 }
149 151
150 return flags; 152 return flags;
151} 153}
152 154
153void SearchDialog::slotOk() 155void SearchDialog::slotOk()
154{ 156{
155 if ( !m_search->currentText().isEmpty() ) 157 if ( !m_search->currentText().isEmpty() )
156 { 158 {
157 if ( !m_optRegExp->isChecked() ) 159 if ( !m_optRegExp->isChecked() )
158 { 160 {
159 accept(); 161 accept();
160 } 162 }
161 else 163 else
162 { 164 {
163 // Check for a valid regular expression. 165 // Check for a valid regular expression.
164 166
165 QRegExp regExp( m_search->currentText() ); 167 QRegExp regExp( m_search->currentText() );
166 168
167 if ( regExp.isValid() ) 169 if ( regExp.isValid() )
168 accept(); 170 accept();
169 } 171 }
170 } 172 }
171} 173}
172 174
173void SearchDialog::setSearchText( const QString &searchstr ) 175void SearchDialog::setSearchText( const QString &searchstr )
174 { 176 {
175 m_search->insertItem( searchstr, 0 ); 177 m_search->insertItem( searchstr, 0 );
176 m_search->setCurrentItem( 0 ); 178 m_search->setCurrentItem( 0 );
177 m_search->lineEdit()->selectAll(); 179 m_search->lineEdit()->selectAll();
178 } 180 }
179 181
180// this dialog is not modal 182// this dialog is not modal
181ReplacePrompt::ReplacePrompt( QWidget *parent ) 183ReplacePrompt::ReplacePrompt( QWidget *parent )
182 : KDialogBase(parent, 0L, false, i18n( "Replace Text" ), 184 : KDialogBase(parent, 0L, false, i18n( "Replace Text" ),
183 User3 | User2 | User1 | Close, User3, true, 185 User3 | User2 | User1 | Close, User3, true,
184 i18n("&All"), i18n("&No"), i18n("&Yes")) { 186 i18n("&All"), i18n("&No"), i18n("&Yes")) {
185 187
186 QWidget *page = new QWidget(this); 188 QWidget *page = new QWidget(this);
187 setMainWidget(page); 189 setMainWidget(page);
188 190
189 QBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); 191 QBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
190 QLabel *label = new QLabel(i18n("Replace this occurence?"),page); 192 QLabel *label = new QLabel(i18n("Replace this occurence?"),page);
191 topLayout->addWidget(label ); 193 topLayout->addWidget(label );
192} 194}
193 195
194void ReplacePrompt::slotUser1( void ) { // All 196void ReplacePrompt::slotUser1( void ) { // All
195 done(KateView::srAll); 197 done(KateView::srAll);
196} 198}
197 199
198void ReplacePrompt::slotUser2( void ) { // No 200void ReplacePrompt::slotUser2( void ) { // No
199 done(KateView::srNo); 201 done(KateView::srNo);
200} 202}
201 203
202void ReplacePrompt::slotUser3( void ) { // Yes 204void ReplacePrompt::slotUser3( void ) { // Yes
203 accept(); 205 accept();
204} 206}
205 207
206void ReplacePrompt::done(int r) { 208void ReplacePrompt::done(int r) {
207 setResult(r); 209 setResult(r);
208 emit clicked(); 210 emit clicked();
209} 211}
210 212
211void ReplacePrompt::closeEvent(QCloseEvent *) { 213void ReplacePrompt::closeEvent(QCloseEvent *) {
212 reject(); 214 reject();
213} 215}
214 216
215GotoLineDialog::GotoLineDialog(QWidget *parent, int line, int max) 217GotoLineDialog::GotoLineDialog(QWidget *parent, int line, int max)
216 : KDialogBase(parent, 0L, true, i18n("Goto Line"), Ok | Cancel, Ok) { 218 : KDialogBase(parent, 0L, true, i18n("Goto Line"), Ok | Cancel, Ok) {
217 219
218 QWidget *page = new QWidget(this); 220 QWidget *page = new QWidget(this);
219 setMainWidget(page); 221 setMainWidget(page);
220 222
221 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); 223 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
222 e1 = new QSpinBox(page); 224 e1 = new QSpinBox(page);
223 e1->setMinValue(1); 225 e1->setMinValue(1);
224 e1->setMaxValue(max); 226 e1->setMaxValue(max);
225 e1->setValue((int)line); 227 e1->setValue((int)line);
226 228
227 QLabel *label = new QLabel( e1,i18n("&Goto Line:"), page ); 229 QLabel *label = new QLabel( e1,i18n("&Goto Line:"), page );
228 topLayout->addWidget(label); 230 topLayout->addWidget(label);
229 topLayout->addWidget(e1); 231 topLayout->addWidget(e1);
230 topLayout->addSpacing(spacingHint()); // A little bit extra space 232 topLayout->addSpacing(spacingHint()); // A little bit extra space
231 topLayout->addStretch(10); 233 topLayout->addStretch(10);
232 e1->setFocus(); 234 e1->setFocus();
233} 235}
234 236
235int GotoLineDialog::getLine() { 237int GotoLineDialog::getLine() {
236 return e1->value(); 238 return e1->value();
237} 239}
238 240
239const int IndentConfigTab::flags[] = {KateView::cfAutoIndent, KateView::cfSpaceIndent, 241const int IndentConfigTab::flags[] = {KateView::cfAutoIndent, KateView::cfSpaceIndent,
240 KateView::cfBackspaceIndents,KateView::cfTabIndents, KateView::cfKeepIndentProfile, KateView::cfKeepExtraSpaces}; 242 KateView::cfBackspaceIndents,KateView::cfTabIndents, KateView::cfKeepIndentProfile, KateView::cfKeepExtraSpaces};
241 243
242IndentConfigTab::IndentConfigTab(QWidget *parent, KateView *view) 244IndentConfigTab::IndentConfigTab(QWidget *parent, KateView *view)
243 : QWidget(parent, 0L) 245 : QWidget(parent, 0L)
244{ 246{
245 QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() ); 247 QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() );
246 int configFlags = view->config(); 248 int configFlags = view->config();
247 249
248 opt[0] = new QCheckBox(i18n("&Auto Indent"), this); 250 opt[0] = new QCheckBox(i18n("&Auto Indent"), this);
249 layout->addWidget(opt[0], 0, AlignLeft); 251 layout->addWidget(opt[0], 0, AlignLeft);
250 opt[0]->setChecked(configFlags & flags[0]); 252 opt[0]->setChecked(configFlags & flags[0]);
251 253
252 opt[1] = new QCheckBox(i18n("Indent With &Spaces"), this); 254 opt[1] = new QCheckBox(i18n("Indent With &Spaces"), this);
253 layout->addWidget(opt[1], 0, AlignLeft); 255 layout->addWidget(opt[1], 0, AlignLeft);
254 opt[1]->setChecked(configFlags & flags[1]); 256 opt[1]->setChecked(configFlags & flags[1]);
255 257
256 opt[2] = new QCheckBox(i18n("&Backspace Key Indents"), this); 258 opt[2] = new QCheckBox(i18n("&Backspace Key Indents"), this);
257 layout->addWidget(opt[2], 0, AlignLeft); 259 layout->addWidget(opt[2], 0, AlignLeft);
258 opt[2]->setChecked(configFlags & flags[2]); 260 opt[2]->setChecked(configFlags & flags[2]);
259 261
260 opt[3] = new QCheckBox(i18n("&Tab Key Indents"), this); 262 opt[3] = new QCheckBox(i18n("&Tab Key Indents"), this);
261 layout->addWidget(opt[3], 0, AlignLeft); 263 layout->addWidget(opt[3], 0, AlignLeft);
262 opt[3]->setChecked(configFlags & flags[3]); 264 opt[3]->setChecked(configFlags & flags[3]);
263 265
264 opt[4] = new QCheckBox(i18n("Keep Indent &Profile"), this); 266 opt[4] = new QCheckBox(i18n("Keep Indent &Profile"), this);
265 layout->addWidget(opt[4], 0, AlignLeft); 267 layout->addWidget(opt[4], 0, AlignLeft);
266// opt[4]->setChecked(configFlags & flags[4]); 268// opt[4]->setChecked(configFlags & flags[4]);
267 opt[4]->setChecked(true); 269 opt[4]->setChecked(true);
268 opt[4]->hide(); 270 opt[4]->hide();
269 271
270 opt[5] = new QCheckBox(i18n("&Keep Extra Spaces"), this); 272 opt[5] = new QCheckBox(i18n("&Keep Extra Spaces"), this);
271 layout->addWidget(opt[5], 0, AlignLeft); 273 layout->addWidget(opt[5], 0, AlignLeft);
272 opt[5]->setChecked(configFlags & flags[5]); 274 opt[5]->setChecked(configFlags & flags[5]);
273 275
274 layout->addStretch(); 276 layout->addStretch();
275 277
276 // What is this? help 278 // What is this? help
277 QWhatsThis::add(opt[0], i18n("When <b>Auto indent</b> is on, KateView will indent new lines to equal the indent on the previous line.<p>If the previous line is blank, the nearest line above with text is used")); 279 QWhatsThis::add(opt[0], i18n("When <b>Auto indent</b> is on, KateView will indent new lines to equal the indent on the previous line.<p>If the previous line is blank, the nearest line above with text is used"));
278 QWhatsThis::add(opt[1], i18n("Check this if you want to indent with spaces rather than tabs.<br>A Tab will be converted to <u>Tab-width</u> as set in the <b>edit</b> options")); 280 QWhatsThis::add(opt[1], i18n("Check this if you want to indent with spaces rather than tabs.<br>A Tab will be converted to <u>Tab-width</u> as set in the <b>edit</b> options"));
279 QWhatsThis::add(opt[2], i18n("This allows the <b>backspace</b> key to be used to indent.")); 281 QWhatsThis::add(opt[2], i18n("This allows the <b>backspace</b> key to be used to indent."));
280 QWhatsThis::add(opt[3], i18n("This allows the <b>tab</b> key to be used to indent.")); 282 QWhatsThis::add(opt[3], i18n("This allows the <b>tab</b> key to be used to indent."));
281 QWhatsThis::add(opt[4], i18n("This retains current indentation settings for future documents.")); 283 QWhatsThis::add(opt[4], i18n("This retains current indentation settings for future documents."));
282 QWhatsThis::add(opt[5], i18n("Indentations of more than the selected number of spaces will not be shortened.")); 284 QWhatsThis::add(opt[5], i18n("Indentations of more than the selected number of spaces will not be shortened."));
283} 285}
284 286
285void IndentConfigTab::getData(KateView *view) { 287void IndentConfigTab::getData(KateView *view) {
286 int configFlags, z; 288 int configFlags, z;
287 289
288 configFlags = view->config(); 290 configFlags = view->config();
289 for (z = 0; z < numFlags; z++) { 291 for (z = 0; z < numFlags; z++) {
290 configFlags &= ~flags[z]; 292 configFlags &= ~flags[z];
291 if (opt[z]->isChecked()) configFlags |= flags[z]; 293 if (opt[z]->isChecked()) configFlags |= flags[z];
292 } 294 }
293 view->setConfig(configFlags); 295 view->setConfig(configFlags);
294} 296}
295 297
296const int SelectConfigTab::flags[] = {KateView::cfPersistent, KateView::cfDelOnInput, 298const int SelectConfigTab::flags[] = {KateView::cfPersistent, KateView::cfDelOnInput,
297 KateView::cfMouseAutoCopy, KateView::cfSingleSelection, KateView::cfVerticalSelect, KateView::cfXorSelect}; 299 KateView::cfMouseAutoCopy, KateView::cfSingleSelection, KateView::cfVerticalSelect, KateView::cfXorSelect};
298 300
299SelectConfigTab::SelectConfigTab(QWidget *parent, KateView *view) 301SelectConfigTab::SelectConfigTab(QWidget *parent, KateView *view)
300 : QWidget(parent, 0L) 302 : QWidget(parent, 0L)
301{ 303{
302 QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() ); 304 QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() );
303 int configFlags = view->config(); 305 int configFlags = view->config();
304 306
305 opt[0] = new QCheckBox(i18n("&Persistent Selections"), this); 307 opt[0] = new QCheckBox(i18n("&Persistent Selections"), this);
306 layout->addWidget(opt[0], 0, AlignLeft); 308 layout->addWidget(opt[0], 0, AlignLeft);
307 opt[0]->setChecked(configFlags & flags[0]); 309 opt[0]->setChecked(configFlags & flags[0]);
308 310
309 opt[1] = new QCheckBox(i18n("&Overwrite Selections"), this); 311 opt[1] = new QCheckBox(i18n("&Overwrite Selections"), this);
310 layout->addWidget(opt[1], 0, AlignLeft); 312 layout->addWidget(opt[1], 0, AlignLeft);
311 opt[1]->setChecked(configFlags & flags[1]); 313 opt[1]->setChecked(configFlags & flags[1]);
312 314
313 opt[2] = new QCheckBox(i18n("Mouse &Autocopy"), this); 315 opt[2] = new QCheckBox(i18n("Mouse &Autocopy"), this);
314 layout->addWidget(opt[2], 0, AlignLeft); 316 layout->addWidget(opt[2], 0, AlignLeft);
315 opt[2]->setChecked(configFlags & flags[2]); 317 opt[2]->setChecked(configFlags & flags[2]);
316 318
317 opt[3] = new QCheckBox(i18n("&X11-like Single Selection"), this); 319 opt[3] = new QCheckBox(i18n("&X11-like Single Selection"), this);
318 layout->addWidget(opt[3], 0, AlignLeft); 320 layout->addWidget(opt[3], 0, AlignLeft);
319 opt[3]->setChecked(configFlags & flags[3]); 321 opt[3]->setChecked(configFlags & flags[3]);
320 322
321 opt[4] = new QCheckBox(i18n("&Vertical Selections"), this); 323 opt[4] = new QCheckBox(i18n("&Vertical Selections"), this);
322 layout->addWidget(opt[4], 0, AlignLeft); 324 layout->addWidget(opt[4], 0, AlignLeft);
323 opt[4]->setChecked(configFlags & flags[4]); 325 opt[4]->setChecked(configFlags & flags[4]);
324 326
325 opt[5] = new QCheckBox(i18n("&Toggle Old"), this); 327 opt[5] = new QCheckBox(i18n("&Toggle Old"), this);
326 layout->addWidget(opt[5], 0, AlignLeft); 328 layout->addWidget(opt[5], 0, AlignLeft);
327 opt[5]->setChecked(configFlags & flags[5]); 329 opt[5]->setChecked(configFlags & flags[5]);
328 330
329 layout->addStretch(); 331 layout->addStretch();
330 332
331 // What is this? help 333 // What is this? help
332 QWhatsThis::add(opt[0], i18n("Enabling this prevents key input or cursor movement by way of the arrow keys from causing the elimination of text selection.<p><b>Note:</b> If the Overwrite Selections option is activated then any typed character input or paste operation will replace the selected text.")); 334 QWhatsThis::add(opt[0], i18n("Enabling this prevents key input or cursor movement by way of the arrow keys from causing the elimination of text selection.<p><b>Note:</b> If the Overwrite Selections option is activated then any typed character input or paste operation will replace the selected text."));
333 QWhatsThis::add(opt[1], i18n("When this is on, any keyed character input or paste operation will replace the selected text.")); 335 QWhatsThis::add(opt[1], i18n("When this is on, any keyed character input or paste operation will replace the selected text."));
334 QWhatsThis::add(opt[2], i18n("When this is on, any text selected with the mouse will be automatically copied to the clipboard.")); 336 QWhatsThis::add(opt[2], i18n("When this is on, any text selected with the mouse will be automatically copied to the clipboard."));
335 QWhatsThis::add(opt[3], i18n("Not implemented yet.")); 337 QWhatsThis::add(opt[3], i18n("Not implemented yet."));
336 QWhatsThis::add(opt[4], i18n("Enabling this allows you to make vertical selections.")); 338 QWhatsThis::add(opt[4], i18n("Enabling this allows you to make vertical selections."));
337 QWhatsThis::add(opt[5], i18n("Not yet implemented.")); 339 QWhatsThis::add(opt[5], i18n("Not yet implemented."));
338} 340}
339 341
340void SelectConfigTab::getData(KateView *view) { 342void SelectConfigTab::getData(KateView *view) {
341 int configFlags, z; 343 int configFlags, z;
342 344
343 configFlags = view->config(); 345 configFlags = view->config();
344 for (z = 0; z < numFlags; z++) { 346 for (z = 0; z < numFlags; z++) {
345 configFlags &= ~flags[z]; // clear flag 347 configFlags &= ~flags[z]; // clear flag
346 if (opt[z]->isChecked()) configFlags |= flags[z]; // set flag if checked 348 if (opt[z]->isChecked()) configFlags |= flags[z]; // set flag if checked
347 } 349 }
348 view->setConfig(configFlags); 350 view->setConfig(configFlags);
349} 351}
350 352
351const int EditConfigTab::flags[] = {KateView::cfWordWrap, KateView::cfReplaceTabs, KateView::cfRemoveSpaces, 353const int EditConfigTab::flags[] = {KateView::cfWordWrap, KateView::cfReplaceTabs, KateView::cfRemoveSpaces,
352 KateView::cfAutoBrackets, KateView::cfGroupUndo, KateView::cfShowTabs, KateView::cfSmartHome, 354 KateView::cfAutoBrackets, KateView::cfGroupUndo, KateView::cfShowTabs, KateView::cfSmartHome,
353 KateView::cfPageUDMovesCursor, KateView::cfWrapCursor}; 355 KateView::cfPageUDMovesCursor, KateView::cfWrapCursor};
354 356
355EditConfigTab::EditConfigTab(QWidget *parent, KateView *view) 357EditConfigTab::EditConfigTab(QWidget *parent, KateView *view)
356 : QWidget(parent, 0L) { 358 : QWidget(parent, 0L) {
357 359
358 QHBoxLayout *mainLayout; 360 QHBoxLayout *mainLayout;
359 QVBoxLayout *cbLayout, *leLayout; 361 QVBoxLayout *cbLayout, *leLayout;
360 int configFlags; 362 int configFlags;
361 363
362 mainLayout = new QHBoxLayout(this, 0, KDialog::spacingHint() ); 364 mainLayout = new QHBoxLayout(this, 0, KDialog::spacingHint() );
363 365
364 // checkboxes 366 // checkboxes
365 cbLayout = new QVBoxLayout( mainLayout ); 367 cbLayout = new QVBoxLayout( mainLayout );
366 configFlags = view->config(); 368 configFlags = view->config();
367 369
368 opt[0] = new QCheckBox(i18n("&Word wrap"), this); 370 opt[0] = new QCheckBox(i18n("&Word wrap"), this);
369 cbLayout->addWidget(opt[0], 0, AlignLeft); 371 cbLayout->addWidget(opt[0], 0, AlignLeft);
370 opt[0]->setChecked(view->doc()->wordWrap()); 372 opt[0]->setChecked(view->doc()->wordWrap());
371 373
372 opt[1] = new QCheckBox(i18n("Replace &tabs with spaces"), this); 374 opt[1] = new QCheckBox(i18n("Replace &tabs with spaces"), this);
373 cbLayout->addWidget(opt[1], 0, AlignLeft); 375 cbLayout->addWidget(opt[1], 0, AlignLeft);
374 opt[1]->setChecked(configFlags & flags[1]); 376 opt[1]->setChecked(configFlags & flags[1]);
375 377
376 opt[2] = new QCheckBox(i18n("&Remove trailing spaces"), this); 378 opt[2] = new QCheckBox(i18n("&Remove trailing spaces"), this);
377 cbLayout->addWidget(opt[2], 0, AlignLeft); 379 cbLayout->addWidget(opt[2], 0, AlignLeft);
378 opt[2]->setChecked(configFlags & flags[2]); 380 opt[2]->setChecked(configFlags & flags[2]);
379 381
380 opt[3] = new QCheckBox(i18n("&Auto brackets"), this); 382 opt[3] = new QCheckBox(i18n("&Auto brackets"), this);
381 cbLayout->addWidget(opt[3], 0, AlignLeft); 383 cbLayout->addWidget(opt[3], 0, AlignLeft);
382 opt[3]->setChecked(configFlags & flags[3]); 384 opt[3]->setChecked(configFlags & flags[3]);
383 385
384 opt[4] = new QCheckBox(i18n("Group &undos"), this); 386 opt[4] = new QCheckBox(i18n("Group &undos"), this);
385 cbLayout->addWidget(opt[4], 0, AlignLeft); 387 cbLayout->addWidget(opt[4], 0, AlignLeft);
386 opt[4]->setChecked(configFlags & flags[4]); 388 opt[4]->setChecked(configFlags & flags[4]);
387 389
388 opt[5] = new QCheckBox(i18n("&Show tabs"), this); 390 opt[5] = new QCheckBox(i18n("&Show tabs"), this);
389 cbLayout->addWidget(opt[5], 0, AlignLeft); 391 cbLayout->addWidget(opt[5], 0, AlignLeft);
390 opt[5]->setChecked(configFlags & flags[5]); 392 opt[5]->setChecked(configFlags & flags[5]);
391 393
392 opt[6] = new QCheckBox(i18n("Smart &home"), this); 394 opt[6] = new QCheckBox(i18n("Smart &home"), this);
393 cbLayout->addWidget(opt[6], 0, AlignLeft); 395 cbLayout->addWidget(opt[6], 0, AlignLeft);
394 opt[6]->setChecked(configFlags & flags[6]); 396 opt[6]->setChecked(configFlags & flags[6]);
395 397
396 opt[7] = new QCheckBox(i18n("&Page up/down moves cursor"), this); 398 opt[7] = new QCheckBox(i18n("&Page up/down moves cursor"), this);
397 cbLayout->addWidget(opt[7], 0, AlignLeft); 399 cbLayout->addWidget(opt[7], 0, AlignLeft);
398 opt[7]->setChecked(configFlags & flags[7]); 400 opt[7]->setChecked(configFlags & flags[7]);
399 401
400 opt[8] = new QCheckBox(i18n("Wrap &cursor"), this); 402 opt[8] = new QCheckBox(i18n("Wrap &cursor"), this);
401 cbLayout->addWidget(opt[8], 0, AlignLeft); 403 cbLayout->addWidget(opt[8], 0, AlignLeft);
402 opt[8]->setChecked(configFlags & flags[8]); 404 opt[8]->setChecked(configFlags & flags[8]);
403 405
404 cbLayout->addStretch(); 406 cbLayout->addStretch();
405 407
406 // edit lines 408 // edit lines
407 leLayout = new QVBoxLayout(); 409 leLayout = new QVBoxLayout();
408 mainLayout->addLayout(leLayout,10); 410 mainLayout->addLayout(leLayout,10);
409 411
410 e1 = new QSpinBox(this); 412 e1 = new QSpinBox(this);
411 e1->setMinValue(20); 413 e1->setMinValue(20);
412 e1->setMaxValue( 200); 414 e1->setMaxValue( 200);
413 e1->setValue((int)(view->doc()->wordWrapAt())); 415 e1->setValue((int)(view->doc()->wordWrapAt()));
414#warning fixme e1->setLabel(i18n("Wrap Words At:")); 416#warning fixme e1->setLabel(i18n("Wrap Words At:"));
415 417
416 e2 = new QSpinBox(this); 418 e2 = new QSpinBox(this);
417 e2->setMinValue(1); 419 e2->setMinValue(1);
418 e2->setMaxValue(16); 420 e2->setMaxValue(16);
419 e2->setValue((int)view->tabWidth()); 421 e2->setValue((int)view->tabWidth());
420 422
421#warning fixme e2->setLabel(i18n("Tab/Indent Width:")); 423#warning fixme e2->setLabel(i18n("Tab/Indent Width:"));
422 424
423 e3 = new QSpinBox(this); 425 e3 = new QSpinBox(this);
424 e3->setMinValue(5); 426 e3->setMinValue(5);
425 e3->setMaxValue( 30000); 427 e3->setMaxValue( 30000);
426#warning fixme e3->setLabel(i18n("Undo steps:")); 428#warning fixme e3->setLabel(i18n("Undo steps:"));
427 e3->setValue((int)view->undoSteps()); 429 e3->setValue((int)view->undoSteps());
428 430
429 leLayout->addWidget(e1, 0, AlignLeft); 431 leLayout->addWidget(e1, 0, AlignLeft);
430 leLayout->addWidget(e2, 0, AlignLeft); 432 leLayout->addWidget(e2, 0, AlignLeft);
431 leLayout->addWidget(e3, 0, AlignLeft); 433 leLayout->addWidget(e3, 0, AlignLeft);
432 434
433 435
434 QVBox *box = new QVBox (this); 436 QVBox *box = new QVBox (this);
435 leLayout->addWidget (box, 0, AlignLeft); 437 leLayout->addWidget (box, 0, AlignLeft);
436 438
437 new QLabel (i18n("Encoding:"), box); 439 new QLabel (i18n("Encoding:"), box);
438 440
439 encoding = new QComboBox(box); 441 encoding = new QComboBox(box);
440#warning fixme 442#warning fixme
441#if 0 443#if 0
442 encoding->insertStringList (KGlobal::charsets()->availableEncodingNames()); 444 encoding->insertStringList (KGlobal::charsets()->availableEncodingNames());
443 encoding->setCurrentItem (KGlobal::charsets()->availableEncodingNames().findIndex(view->doc()->encoding())); 445 encoding->setCurrentItem (KGlobal::charsets()->availableEncodingNames().findIndex(view->doc()->encoding()));
444#endif 446#endif
445 leLayout->addStretch(); 447 leLayout->addStretch();
446 448
447 // What is this? help 449 // What is this? help
448 QWhatsThis::add(opt[0], i18n("Word wrap is a feature that causes the editor to automatically start a new line of text and move (wrap) the cursor to the beginning of that new line. KateView will automatically start a new line of text when the current line reaches the length specified by the Wrap Words At: option.<p><b>NOTE:<b> Word Wrap will not change existing lines or wrap them for easy reading as in some applications.")); 450 QWhatsThis::add(opt[0], i18n("Word wrap is a feature that causes the editor to automatically start a new line of text and move (wrap) the cursor to the beginning of that new line. KateView will automatically start a new line of text when the current line reaches the length specified by the Wrap Words At: option.<p><b>NOTE:<b> Word Wrap will not change existing lines or wrap them for easy reading as in some applications."));
449 QWhatsThis::add(e1, i18n("If the Word Wrap option is selected this entry determines the length (in characters) at which the editor will automatically start a new line.")); 451 QWhatsThis::add(e1, i18n("If the Word Wrap option is selected this entry determines the length (in characters) at which the editor will automatically start a new line."));
450 QWhatsThis::add(opt[1], i18n("KateView will replace any tabs with the number of spaces indicated in the Tab Width: entry.")); 452 QWhatsThis::add(opt[1], i18n("KateView will replace any tabs with the number of spaces indicated in the Tab Width: entry."));
451 QWhatsThis::add(e2, i18n("If the Replace Tabs By Spaces option is selected this entry determines the number of spaces with which the editor will automatically replace tabs.")); 453 QWhatsThis::add(e2, i18n("If the Replace Tabs By Spaces option is selected this entry determines the number of spaces with which the editor will automatically replace tabs."));
452 QWhatsThis::add(opt[2], i18n("KateView will automatically eliminate extra spaces at the ends of lines of text.")); 454 QWhatsThis::add(opt[2], i18n("KateView will automatically eliminate extra spaces at the ends of lines of text."));
453 QWhatsThis::add(opt[3], i18n("When the user types a left bracket ([,(, or {) KateView automatically enters the right bracket (}, ), or ]) to the right of the cursor.")); 455 QWhatsThis::add(opt[3], i18n("When the user types a left bracket ([,(, or {) KateView automatically enters the right bracket (}, ), or ]) to the right of the cursor."));
454 QWhatsThis::add(opt[4], i18n("Checking this will cause sequences of similar actions to be undone at once.")); 456 QWhatsThis::add(opt[4], i18n("Checking this will cause sequences of similar actions to be undone at once."));
455 QWhatsThis::add(opt[5], i18n("The editor will display a symbol to indicate the presence of a tab in the text.")); 457 QWhatsThis::add(opt[5], i18n("The editor will display a symbol to indicate the presence of a tab in the text."));
456 QWhatsThis::add(opt[6], i18n("Not yet implemented.")); 458 QWhatsThis::add(opt[6], i18n("Not yet implemented."));
457 QWhatsThis::add(opt[7], i18n("If this is selected, the insertion cursor will be moved to the first/last line when pressing the page up/down buttons.<p>If not selected, it will remain at it's relative position in the visible text.")); 459 QWhatsThis::add(opt[7], i18n("If this is selected, the insertion cursor will be moved to the first/last line when pressing the page up/down buttons.<p>If not selected, it will remain at it's relative position in the visible text."));
458 QWhatsThis::add(e3, i18n("Sets the number of undo/redo steps to record. More steps uses more memory.")); 460 QWhatsThis::add(e3, i18n("Sets the number of undo/redo steps to record. More steps uses more memory."));
459 QWhatsThis::add(opt[8], i18n("When on, moving the insertion cursor using the <b>Left</b> and <b>Right</b> keys will go on to previous/next line at beginning/end of the line, similar to most editors.<p>When off, the insertion cursor cannot be moved left of the line start, but it can be moved off the line end, which can be very handy for programmers.")); 461 QWhatsThis::add(opt[8], i18n("When on, moving the insertion cursor using the <b>Left</b> and <b>Right</b> keys will go on to previous/next line at beginning/end of the line, similar to most editors.<p>When off, the insertion cursor cannot be moved left of the line start, but it can be moved off the line end, which can be very handy for programmers."));
460} 462}
461 463
462void EditConfigTab::getData(KateView *view) 464void EditConfigTab::getData(KateView *view)
463{ 465{
464 int configFlags, z; 466 int configFlags, z;
465 467
466 configFlags = view->config(); 468 configFlags = view->config();
467 for (z = 1; z < numFlags; z++) { 469 for (z = 1; z < numFlags; z++) {
468 configFlags &= ~flags[z]; 470 configFlags &= ~flags[z];
469 if (opt[z]->isChecked()) configFlags |= flags[z]; 471 if (opt[z]->isChecked()) configFlags |= flags[z];
470 } 472 }
471 view->setConfig(configFlags); 473 view->setConfig(configFlags);
472 474
473 view->setEncoding (encoding->currentText()); 475 view->setEncoding (encoding->currentText());
474 view->doc()->setWordWrapAt(e1->value()); 476 view->doc()->setWordWrapAt(e1->value());
475 view->doc()->setWordWrap (opt[0]->isChecked()); 477 view->doc()->setWordWrap (opt[0]->isChecked());
476 view->setTabWidth(e2->value()); 478 view->setTabWidth(e2->value());
477 view->setUndoSteps(e3->value()); 479 view->setUndoSteps(e3->value());
478} 480}
479 481
480ColorConfig::ColorConfig( QWidget *parent, char *name ) 482ColorConfig::ColorConfig( QWidget *parent, char *name )
481 : QWidget( parent, name ) 483 : QWidget( parent, name )
482{ 484{
483 QGridLayout *glay = new QGridLayout( this, 6, 2, 0, KDialog::spacingHint()); 485 QGridLayout *glay = new QGridLayout( this, 6, 2, 0, KDialog::spacingHint());
484 glay->setColStretch(1,1); 486 glay->setColStretch(1,1);
485 glay->setRowStretch(5,1); 487 glay->setRowStretch(5,1);
486 488
487 QLabel *label; 489 QLabel *label;
488 490
489 label = new QLabel( i18n("Background:"), this); 491 label = new QLabel( i18n("Background:"), this);
490 label->setAlignment( AlignRight|AlignVCenter ); 492 label->setAlignment( AlignRight|AlignVCenter );
491 m_back = new KColorButton( this ); 493 m_back = new KColorButton( this );
492 glay->addWidget( label, 0, 0 ); 494 glay->addWidget( label, 0, 0 );
493 glay->addWidget( m_back, 0, 1 ); 495 glay->addWidget( m_back, 0, 1 );
494 496
495 label = new QLabel( i18n("Selected:"), this); 497 label = new QLabel( i18n("Selected:"), this);
496 label->setAlignment( AlignRight|AlignVCenter ); 498 label->setAlignment( AlignRight|AlignVCenter );
497 m_selected = new KColorButton( this ); 499 m_selected = new KColorButton( this );
498 glay->addWidget( label, 2, 0 ); 500 glay->addWidget( label, 2, 0 );
499 glay->addWidget( m_selected, 2, 1 ); 501 glay->addWidget( m_selected, 2, 1 );
500 502
501 // QWhatsThis help 503 // QWhatsThis help
502 QWhatsThis::add(m_back, i18n("Sets the background color of the editing area")); 504 QWhatsThis::add(m_back, i18n("Sets the background color of the editing area"));
503 QWhatsThis::add(m_selected, i18n("Sets the background color of the selection. To set the text color for selected text, use the &quot;<b>Configure Highlighting</b>&quot; dialog.")); 505 QWhatsThis::add(m_selected, i18n("Sets the background color of the selection. To set the text color for selected text, use the &quot;<b>Configure Highlighting</b>&quot; dialog."));
504} 506}
505 507
506 508
507ColorConfig::~ColorConfig() 509ColorConfig::~ColorConfig()
508{ 510{
509} 511}
510 512
511void ColorConfig::setColors(QColor *colors) 513void ColorConfig::setColors(QColor *colors)
512{ 514{
513 m_back->setColor( colors[0] ); 515 m_back->setColor( colors[0] );
514 m_selected->setColor( colors[1] ); 516 m_selected->setColor( colors[1] );
515} 517}
516 518
517void ColorConfig::getColors(QColor *colors) 519void ColorConfig::getColors(QColor *colors)
518{ 520{
519 colors[0] = m_back->color(); 521 colors[0] = m_back->color();
520 colors[1] = m_selected->color(); 522 colors[1] = m_selected->color();
521} 523}
522 524
523FontConfig::FontConfig( QWidget *parent, char *name ) 525FontConfig::FontConfig( QWidget *parent, char *name )
524 : QWidget( parent, name ) 526 : QWidget( parent, name )
525{ 527{
526 // sizemanagment 528 // sizemanagment
527 QGridLayout *grid = new QGridLayout( this, 1, 1 ); 529 QGridLayout *grid = new QGridLayout( this, 1, 1 );
528#if 0 530// QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" );
529 m_fontchooser = new KFontChooser ( this ); 531// QString styleStr = cfg. readEntry ( "FontStyle", "Regular" );
530 m_fontchooser->enableColumn(KFontChooser::StyleList, false); 532// int size = cfg. readNumEntry ( "FontSize", 10 );
531 grid->addWidget( m_fontchooser, 0, 0); 533// OFontSelector *m_fontselect;
532 534
533 connect (m_fontchooser, SIGNAL (fontSelected( const QFont & )), this, SLOT (slotFontSelected( const QFont & ))); 535 m_fontselect = new OFontSelector ( false, this, "FontTab" );
534#endif 536// m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
537// QWhatsThis::add( m_fontselect,
538// tr( "Select the desired name, style and size of the default font applications will use." ) );
539
540 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )),
541 this, SLOT( slotFontSelected( const QFont & )));
542 grid->addWidget( m_fontselect, 0, 0);
543
544
545// #if 0
546// m_fontchooser = new KFontChooser ( this );
547// m_fontchooser->enableColumn(KFontChooser::StyleList, false);
548// grid->addWidget( m_fontchooser, 0, 0);
549
550// connect (m_fontchooser, SIGNAL (fontSelected( const QFont & )), this, SLOT (slotFontSelected( const QFont & )));
551// #endif
535} 552}
536 553
537FontConfig::~FontConfig() 554FontConfig::~FontConfig()
538{ 555{
539} 556}
540 557
541void FontConfig::setFont ( const QFont &font ) 558void FontConfig::setFont ( const QFont &font )
542{ 559{
543#if 0 560//#if 0
544 m_fontchooser->setFont (font); 561m_fontselect->setFont (font);
545 myFont = font; 562 myFont = font;
546#endif 563//#endif
547} 564}
548 565
549void FontConfig::slotFontSelected( const QFont &font ) 566void FontConfig::slotFontSelected( const QFont &font )
550{ 567{
551 myFont = font; 568 myFont = font;
552} 569}
553 570
554 571
555 572
556 573
diff --git a/noncore/apps/tinykate/libkate/view/kateviewdialog.h b/noncore/apps/tinykate/libkate/view/kateviewdialog.h
index 60f30bd..2ce5a11 100644
--- a/noncore/apps/tinykate/libkate/view/kateviewdialog.h
+++ b/noncore/apps/tinykate/libkate/view/kateviewdialog.h
@@ -1,194 +1,196 @@
1/*************************************************************************** 1/***************************************************************************
2 kateviewdialog.h - description 2 kateviewdialog.h - description
3 ------------------- 3 -------------------
4 copyright : (C) 2001 by The Kate Team 4 copyright : (C) 2001 by The Kate Team
5 (C) 2002 by Joseph Wenninger 5 (C) 2002 by Joseph Wenninger
6 email : kwrite-devel@kde.org 6 email : kwrite-devel@kde.org
7 jowenn@kde.org 7 jowenn@kde.org
8 8
9 ***************************************************************************/ 9 ***************************************************************************/
10 10
11/*************************************************************************** 11/***************************************************************************
12 * * 12 * *
13 * This program is free software; you can redistribute it and/or modify * 13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by * 14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or * 15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. * 16 * (at your option) any later version. *
17 * * 17 * *
18 ***************************************************************************/ 18 ***************************************************************************/
19// Dialogs 19// Dialogs
20 20
21#ifndef _KWDIALOG_H_ 21#ifndef _KWDIALOG_H_
22#define _KWDIALOG_H_ 22#define _KWDIALOG_H_
23 23
24 24
25class QCheckBox; 25class QCheckBox;
26class QLineEdit; 26class QLineEdit;
27class QPushButton; 27class QPushButton;
28class QRadioButton; 28class QRadioButton;
29class QSpinBox; 29class QSpinBox;
30class KColorButton; 30class KColorButton;
31class QComboBox; 31class QComboBox;
32 32
33#include <kdialogbase.h> 33#include <kdialogbase.h>
34#include <opie/ofontselector.h>
34#include "kateview.h" 35#include "kateview.h"
35 36
36class SearchDialog : public KDialogBase 37class SearchDialog : public KDialogBase
37{ 38{
38 Q_OBJECT 39 Q_OBJECT
39 40
40 public: 41 public:
41 SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags ); 42 SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags );
42 QString getSearchFor(); 43 QString getSearchFor();
43 QString getReplaceWith(); 44 QString getReplaceWith();
44 int getFlags(); 45 int getFlags();
45 void setSearchText( const QString &searchstr ); 46 void setSearchText( const QString &searchstr );
46 47
47 protected slots: 48 protected slots:
48 void slotOk(); 49 void slotOk();
49 50
50 protected: 51 protected:
51 QComboBox *m_search; 52 QComboBox *m_search;
52 QComboBox *m_replace; 53 QComboBox *m_replace;
53 QCheckBox *m_opt1; 54 QCheckBox *m_opt1;
54 QCheckBox *m_opt2; 55 QCheckBox *m_opt2;
55 QCheckBox *m_opt3; 56 QCheckBox *m_opt3;
56 QCheckBox *m_optRegExp; 57 QCheckBox *m_optRegExp;
57 QCheckBox *m_opt4; 58 QCheckBox *m_opt4;
58 QCheckBox *m_opt5; 59 QCheckBox *m_opt5;
59 QCheckBox *m_opt6; 60 QCheckBox *m_opt6;
60}; 61};
61 62
62class ReplacePrompt : public KDialogBase 63class ReplacePrompt : public KDialogBase
63{ 64{
64 Q_OBJECT 65 Q_OBJECT
65 66
66 public: 67 public:
67 68
68 ReplacePrompt(QWidget *parent); 69 ReplacePrompt(QWidget *parent);
69 70
70 signals: 71 signals:
71 72
72 void clicked(); 73 void clicked();
73 74
74 protected slots: 75 protected slots:
75 76
76 void slotUser1( void ); // All 77 void slotUser1( void ); // All
77 void slotUser2( void ); // No 78 void slotUser2( void ); // No
78 void slotUser3( void ); // Yes 79 void slotUser3( void ); // Yes
79 virtual void done(int); 80 virtual void done(int);
80 81
81 protected: 82 protected:
82 83
83 void closeEvent(QCloseEvent *); 84 void closeEvent(QCloseEvent *);
84}; 85};
85 86
86class GotoLineDialog : public KDialogBase 87class GotoLineDialog : public KDialogBase
87{ 88{
88 Q_OBJECT 89 Q_OBJECT
89 90
90 public: 91 public:
91 92
92 GotoLineDialog(QWidget *parent, int line, int max); 93 GotoLineDialog(QWidget *parent, int line, int max);
93 int getLine(); 94 int getLine();
94 95
95 protected: 96 protected:
96 97
97 QSpinBox *e1; 98 QSpinBox *e1;
98 QPushButton *btnOK; 99 QPushButton *btnOK;
99}; 100};
100 101
101class IndentConfigTab : public QWidget 102class IndentConfigTab : public QWidget
102{ 103{
103 Q_OBJECT 104 Q_OBJECT
104 105
105 public: 106 public:
106 107
107 IndentConfigTab(QWidget *parent, KateView *); 108 IndentConfigTab(QWidget *parent, KateView *);
108 void getData(KateView *); 109 void getData(KateView *);
109 110
110 protected: 111 protected:
111 112
112 static const int numFlags = 6; 113 static const int numFlags = 6;
113 static const int flags[numFlags]; 114 static const int flags[numFlags];
114 QCheckBox *opt[numFlags]; 115 QCheckBox *opt[numFlags];
115}; 116};
116 117
117class SelectConfigTab : public QWidget 118class SelectConfigTab : public QWidget
118{ 119{
119 Q_OBJECT 120 Q_OBJECT
120 121
121 public: 122 public:
122 123
123 SelectConfigTab(QWidget *parent, KateView *); 124 SelectConfigTab(QWidget *parent, KateView *);
124 void getData(KateView *); 125 void getData(KateView *);
125 126
126 protected: 127 protected:
127 128
128 static const int numFlags = 6; 129 static const int numFlags = 6;
129 static const int flags[numFlags]; 130 static const int flags[numFlags];
130 QCheckBox *opt[numFlags]; 131 QCheckBox *opt[numFlags];
131}; 132};
132 133
133class EditConfigTab : public QWidget 134class EditConfigTab : public QWidget
134{ 135{
135 Q_OBJECT 136 Q_OBJECT
136 137
137 public: 138 public:
138 139
139 EditConfigTab(QWidget *parent, KateView *); 140 EditConfigTab(QWidget *parent, KateView *);
140 void getData(KateView *); 141 void getData(KateView *);
141 142
142 protected: 143 protected:
143 144
144 static const int numFlags = 9; 145 static const int numFlags = 9;
145 static const int flags[numFlags]; 146 static const int flags[numFlags];
146 QCheckBox *opt[numFlags]; 147 QCheckBox *opt[numFlags];
147 QComboBox *encoding; 148 QComboBox *encoding;
148 149
149 150
150 QSpinBox *e1; 151 QSpinBox *e1;
151 QSpinBox *e2; 152 QSpinBox *e2;
152 QSpinBox *e3; 153 QSpinBox *e3;
153}; 154};
154 155
155class ColorConfig : public QWidget 156class ColorConfig : public QWidget
156{ 157{
157 Q_OBJECT 158 Q_OBJECT
158 159
159public: 160public:
160 161
161 ColorConfig( QWidget *parent = 0, char *name = 0 ); 162 ColorConfig( QWidget *parent = 0, char *name = 0 );
162 ~ColorConfig(); 163 ~ColorConfig();
163 164
164 void setColors( QColor * ); 165 void setColors( QColor * );
165 void getColors( QColor * ); 166 void getColors( QColor * );
166 167
167private: 168private:
168 169
169 KColorButton *m_back; 170 KColorButton *m_back;
170 KColorButton *m_selected; 171 KColorButton *m_selected;
171}; 172};
172 173
173class FontConfig : public QWidget 174class FontConfig : public QWidget
174{ 175{
175 Q_OBJECT 176 Q_OBJECT
176 177
177public: 178public:
178 179
179 FontConfig( QWidget *parent = 0, char *name = 0 ); 180 FontConfig( QWidget *parent = 0, char *name = 0 );
180 ~FontConfig(); 181 ~FontConfig();
181 182
182 void setFont ( const QFont &font ); 183 void setFont ( const QFont &font );
183 QFont getFont ( ) { return myFont; }; 184 QFont getFont ( ) { return myFont; };
184 185
185 private: 186 private:
187 OFontSelector *m_fontselect;
186// class KFontChooser *m_fontchooser; 188// class KFontChooser *m_fontchooser;
187 QFont myFont; 189 QFont myFont;
188 190
189 private slots: 191 private slots:
190 void slotFontSelected( const QFont &font ); 192 void slotFontSelected( const QFont &font );
191}; 193};
192 194
193 195
194#endif //_KWDIALOG_H_ 196#endif //_KWDIALOG_H_