summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/Bkmks.cpp2
-rw-r--r--noncore/apps/opie-reader/BuffDoc.cpp2
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.cpp46
3 files changed, 25 insertions, 25 deletions
diff --git a/noncore/apps/opie-reader/Bkmks.cpp b/noncore/apps/opie-reader/Bkmks.cpp
index 92ed69f..0cb9ea9 100644
--- a/noncore/apps/opie-reader/Bkmks.cpp
+++ b/noncore/apps/opie-reader/Bkmks.cpp
@@ -161,25 +161,25 @@ Bkmk* BkmkFile::read()
161 return b; 161 return b;
162} 162}
163 163
164CList<Bkmk>* BkmkFile::readall() 164CList<Bkmk>* BkmkFile::readall()
165{ 165{
166 CList<Bkmk>* bl = NULL; 166 CList<Bkmk>* bl = NULL;
167 if (f != NULL) 167 if (f != NULL)
168 { 168 {
169 unsigned long newmagic; 169 unsigned long newmagic;
170 fread(&newmagic, sizeof(newmagic), 1, f); 170 fread(&newmagic, sizeof(newmagic), 1, f);
171 if (newmagic != magic) 171 if (newmagic != magic)
172 { 172 {
173 if (QMessageBox::warning(NULL, "Old bookmark file!", "Which version of QTReader\ndid you upgrade from?", "0_4*", "Any other version") == 0) 173 if (QMessageBox::warning(NULL, "Old bookmark file!", "Which version of OpieReader\ndid you upgrade from?", "0_4*", "Any other version") == 0)
174 { 174 {
175 fseek(f,0,SEEK_SET); 175 fseek(f,0,SEEK_SET);
176 bl = readall04(); 176 bl = readall04();
177 } 177 }
178 else 178 else
179 { 179 {
180 fseek(f,0,SEEK_SET); 180 fseek(f,0,SEEK_SET);
181 bl = readall03(); 181 bl = readall03();
182 } 182 }
183 isUpgraded = true; 183 isUpgraded = true;
184 } 184 }
185 else 185 else
diff --git a/noncore/apps/opie-reader/BuffDoc.cpp b/noncore/apps/opie-reader/BuffDoc.cpp
index e37b136..d4541ea 100644
--- a/noncore/apps/opie-reader/BuffDoc.cpp
+++ b/noncore/apps/opie-reader/BuffDoc.cpp
@@ -200,25 +200,25 @@ int BuffDoc::openfile(QWidget* _parent, const char *src)
200 } 200 }
201#else 201#else
202 if (ret != 0) 202 if (ret != 0)
203 { 203 {
204 delete exp; 204 delete exp;
205 exp = new Text; 205 exp = new Text;
206 ret = exp->openfile(src); 206 ret = exp->openfile(src);
207 } 207 }
208#endif 208#endif
209 if (ret != 0) 209 if (ret != 0)
210 { 210 {
211 delete exp; 211 delete exp;
212 QMessageBox::information(_parent, "QTReader", "Unknown file compression type","Try another file"); 212 QMessageBox::information(_parent, "OpieReader", "Unknown file compression type","Try another file");
213 return ret; 213 return ret;
214 } 214 }
215 // qDebug("Doing final open:%x:%x",exp,filt); 215 // qDebug("Doing final open:%x:%x",exp,filt);
216 216
217 lastword.empty(); 217 lastword.empty();
218 lastsizes[0] = laststartline = 0; 218 lastsizes[0] = laststartline = 0;
219 lastispara = false; 219 lastispara = false;
220 exp->locate(0); 220 exp->locate(0);
221 filt->setsource(exp); 221 filt->setsource(exp);
222 // qDebug("BuffDoc:file opened"); 222 // qDebug("BuffDoc:file opened");
223 return 0; 223 return 0;
224} 224}
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp
index 0608b66..ef1f4f1 100644
--- a/noncore/apps/opie-reader/QTReaderApp.cpp
+++ b/noncore/apps/opie-reader/QTReaderApp.cpp
@@ -90,44 +90,44 @@ void QTReaderApp::listBkmkFiles()
90 90
91 if (cnt > 0) 91 if (cnt > 0)
92 { 92 {
93//tjw menu->hide(); 93//tjw menu->hide();
94 editBar->hide(); 94 editBar->hide();
95 if (m_fontVisible) m_fontBar->hide(); 95 if (m_fontVisible) m_fontBar->hide();
96 if (regVisible) regBar->hide(); 96 if (regVisible) regBar->hide();
97 if (searchVisible) searchBar->hide(); 97 if (searchVisible) searchBar->hide();
98 m_nRegAction = cRmBkmkFile; 98 m_nRegAction = cRmBkmkFile;
99 editorStack->raiseWidget( bkmkselector ); 99 editorStack->raiseWidget( bkmkselector );
100 } 100 }
101 else 101 else
102 QMessageBox::information(this, "QTReader", "No bookmark files"); 102 QMessageBox::information(this, "OpieReader", "No bookmark files");
103} 103}
104 104
105QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) 105QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
106 : QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false) 106 : QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false)
107{ 107{
108// qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir()); 108// qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir());
109// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml")); 109// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml"));
110 110
111 pBkmklist = NULL; 111 pBkmklist = NULL;
112 doc = 0; 112 doc = 0;
113 113
114 m_fBkmksChanged = false; 114 m_fBkmksChanged = false;
115 115
116 QString lang = getenv( "LANG" ); 116 QString lang = getenv( "LANG" );
117 117
118 m_autogenstr = "^ *[A-Z].*[a-z] *$"; 118 m_autogenstr = "^ *[A-Z].*[a-z] *$";
119 setToolBarsMovable( FALSE ); 119 setToolBarsMovable( FALSE );
120 120
121 setIcon( Resource::loadPixmap( "uqtreader" ) ); 121 setIcon( Resource::loadPixmap( "opie-reader/uqtreader" ) );
122 122
123 QPEToolBar *bar = new QPEToolBar( this ); 123 QPEToolBar *bar = new QPEToolBar( this );
124 bar->setHorizontalStretchable( TRUE ); 124 bar->setHorizontalStretchable( TRUE );
125 addToolBar(bar, "tool",QMainWindow::Top, true); 125 addToolBar(bar, "tool",QMainWindow::Top, true);
126//tjw menu = bar; 126//tjw menu = bar;
127 127
128 QPEMenuBar *mb = new QPEMenuBar( bar ); 128 QPEMenuBar *mb = new QPEMenuBar( bar );
129 QPopupMenu *file = new QPopupMenu( this ); 129 QPopupMenu *file = new QPopupMenu( this );
130 QPopupMenu *format = new QPopupMenu( this ); 130 QPopupMenu *format = new QPopupMenu( this );
131 // QPopupMenu *edit = new QPopupMenu( this ); 131 // QPopupMenu *edit = new QPopupMenu( this );
132 132
133// bar = new QToolBar( this ); 133// bar = new QToolBar( this );
@@ -246,25 +246,25 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
246 246
247 m_buttonAction[0] = new QAction( tr( "Open File" ), QString::null, 0, ag, NULL, true ); 247 m_buttonAction[0] = new QAction( tr( "Open File" ), QString::null, 0, ag, NULL, true );
248 248
249 m_buttonAction[1] = new QAction( tr( "Autoscroll" ), QString::null, 0, ag, NULL, true ); 249 m_buttonAction[1] = new QAction( tr( "Autoscroll" ), QString::null, 0, ag, NULL, true );
250 250
251 m_buttonAction[2] = new QAction( tr( "Mark" ), QString::null, 0, ag, NULL, true ); 251 m_buttonAction[2] = new QAction( tr( "Mark" ), QString::null, 0, ag, NULL, true );
252 252
253 ag->addTo(spacemenu); 253 ag->addTo(spacemenu);
254 254
255 connect(ag, SIGNAL( selected(QAction*) ), this, SLOT( buttonActionSelected(QAction*) ) ); 255 connect(ag, SIGNAL( selected(QAction*) ), this, SLOT( buttonActionSelected(QAction*) ) );
256 256
257 257
258 a = m_scrollButton = new QAction( tr( "Scroll" ), Resource::loadPixmap( "panel-arrow-down" ), QString::null, 0, this, 0, true ); 258 a = m_scrollButton = new QAction( tr( "Scroll" ), Resource::loadPixmap( "opie-reader/panel-arrow-down" ), QString::null, 0, this, 0, true );
259// connect( a, SIGNAL( activated() ), this, SLOT( autoScroll() ) ); 259// connect( a, SIGNAL( activated() ), this, SLOT( autoScroll() ) );
260 a->setOn(false); 260 a->setOn(false);
261 connect( a, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) ); 261 connect( a, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) );
262 file->insertSeparator(); 262 file->insertSeparator();
263 a->addTo( bar ); 263 a->addTo( bar );
264 a->addTo( file ); 264 a->addTo( file );
265 265
266 /* 266 /*
267 a = new QAction( tr( "Find" ), QString::null, 0, this, NULL, true ); 267 a = new QAction( tr( "Find" ), QString::null, 0, this, NULL, true );
268 // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) ); 268 // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) );
269 a->addTo( file ); 269 a->addTo( file );
270 270
@@ -621,31 +621,31 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
621 621
622void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) 622void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data)
623{ 623{
624 QString msg = QString::fromUtf8(_msg); 624 QString msg = QString::fromUtf8(_msg);
625 625
626// qDebug("Received:%s", (const char*)msg); 626// qDebug("Received:%s", (const char*)msg);
627 627
628 QDataStream stream( _data, IO_ReadOnly ); 628 QDataStream stream( _data, IO_ReadOnly );
629 if ( msg == "info(QString)" ) 629 if ( msg == "info(QString)" )
630 { 630 {
631 QString info; 631 QString info;
632 stream >> info; 632 stream >> info;
633 QMessageBox::information(this, "QTReader", info); 633 QMessageBox::information(this, "OpieReader", info);
634 } 634 }
635 else if ( msg == "warn(QString)" ) 635 else if ( msg == "warn(QString)" )
636 { 636 {
637 QString info; 637 QString info;
638 stream >> info; 638 stream >> info;
639 QMessageBox::warning(this, "QTReader", info); 639 QMessageBox::warning(this, "OpieReader", info);
640 } 640 }
641 641
642 642
643 else if ( msg == "exit()" ) 643 else if ( msg == "exit()" )
644 { 644 {
645 m_dontSave = true; 645 m_dontSave = true;
646 close(); 646 close();
647 } 647 }
648 else if ( msg == "pageDown()" ) 648 else if ( msg == "pageDown()" )
649 { 649 {
650 reader->dopagedn(); 650 reader->dopagedn();
651 } 651 }
@@ -742,25 +742,25 @@ void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data)
742 QString info; 742 QString info;
743 stream >> info; 743 stream >> info;
744 QRegExp arg(info); 744 QRegExp arg(info);
745 size_t pos = reader->pagelocate(); 745 size_t pos = reader->pagelocate();
746 size_t start = pos; 746 size_t start = pos;
747 CDrawBuffer test(&(reader->m_fontControl)); 747 CDrawBuffer test(&(reader->m_fontControl));
748 reader->buffdoc.getline(&test,reader->width()); 748 reader->buffdoc.getline(&test,reader->width());
749 while (arg.match(toQString(test.data())) == -1) 749 while (arg.match(toQString(test.data())) == -1)
750 { 750 {
751 pos = reader->locate(); 751 pos = reader->locate();
752 if (!reader->buffdoc.getline(&test,reader->width())) 752 if (!reader->buffdoc.getline(&test,reader->width()))
753 { 753 {
754 QMessageBox::information(this, "QTReader", QString("Can't find\n")+info); 754 QMessageBox::information(this, "OpieReader", QString("Can't find\n")+info);
755 pos = start; 755 pos = start;
756 break; 756 break;
757 } 757 }
758 } 758 }
759 reader->locate(pos); 759 reader->locate(pos);
760 } 760 }
761 else if ( msg == "Layout/Strip CR(int)" ) 761 else if ( msg == "Layout/Strip CR(int)" )
762 { 762 {
763 int info; 763 int info;
764 stream >> info; 764 stream >> info;
765 stripcr(info); 765 stripcr(info);
766 } 766 }
@@ -905,84 +905,84 @@ void QTReaderApp::buttonActionSelected(QAction* _a)
905 905
906QTReaderApp::~QTReaderApp() 906QTReaderApp::~QTReaderApp()
907{ 907{
908} 908}
909 909
910void QTReaderApp::autoScroll(bool _b) 910void QTReaderApp::autoScroll(bool _b)
911{ 911{
912 reader->setautoscroll(_b); 912 reader->setautoscroll(_b);
913} 913}
914 914
915void QTReaderApp::TBD() 915void QTReaderApp::TBD()
916{ 916{
917 QMessageBox::information(this, "QTReader", "Not yet implemented", 1); 917 QMessageBox::information(this, "OpieReader", "Not yet implemented", 1);
918} 918}
919 919
920void QTReaderApp::TBDzoom() 920void QTReaderApp::TBDzoom()
921{ 921{
922 QMessageBox::information(this, "QTReader", "Zooming is done interactively\nTry left/right cursor keys", 1); 922 QMessageBox::information(this, "OpieReader", "Zooming is done interactively\nTry left/right cursor keys", 1);
923} 923}
924 924
925void QTReaderApp::clearBkmkList() 925void QTReaderApp::clearBkmkList()
926{ 926{
927 delete pBkmklist; 927 delete pBkmklist;
928 pBkmklist = NULL; 928 pBkmklist = NULL;
929 m_fBkmksChanged = false; 929 m_fBkmksChanged = false;
930} 930}
931 931
932void QTReaderApp::fileOpen() 932void QTReaderApp::fileOpen()
933{ 933{
934/* 934/*
935 menu->hide(); 935 menu->hide();
936 editBar->hide(); 936 editBar->hide();
937 if (regVisible) regBar->hide(); 937 if (regVisible) regBar->hide();
938 if (searchVisible) searchBar->hide(); 938 if (searchVisible) searchBar->hide();
939*/ 939*/
940 if (pBkmklist != NULL) 940 if (pBkmklist != NULL)
941 { 941 {
942 if (m_fBkmksChanged) 942 if (m_fBkmksChanged)
943 { 943 {
944 if (QMessageBox::warning(this, "QTReader", "Save bookmarks?", "Save", "Don't bother") == 0) 944 if (QMessageBox::warning(this, "OpieReader", "Save bookmarks?", "Save", "Don't bother") == 0)
945 savebkmks(); 945 savebkmks();
946 } 946 }
947 delete pBkmklist; 947 delete pBkmklist;
948 pBkmklist = NULL; 948 pBkmklist = NULL;
949 m_fBkmksChanged = false; 949 m_fBkmksChanged = false;
950 } 950 }
951 reader->disableAutoscroll(); 951 reader->disableAutoscroll();
952/* 952/*
953 editorStack->raiseWidget( fileSelector ); 953 editorStack->raiseWidget( fileSelector );
954 fileSelector->reread(); 954 fileSelector->reread();
955*/ 955*/
956 fileBrowser* fb = new fileBrowser(this,"QTReader",TRUE, 956 fileBrowser* fb = new fileBrowser(this,"OpieReader",TRUE,
957 0, 957 0,
958 // WStyle_Customize | WStyle_NoBorderEx, 958 // WStyle_Customize | WStyle_NoBorderEx,
959 "*", QFileInfo(reader->m_lastfile).dirPath(true)); 959 "*", QFileInfo(reader->m_lastfile).dirPath(true));
960 960
961 if (fb->exec()) 961 if (fb->exec())
962 { 962 {
963 QString fn(fb->fileList[0]); 963 QString fn(fb->fileList[0]);
964// fb->populateList(); 964// fb->populateList();
965 if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn); 965 if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn);
966 } 966 }
967 delete fb; 967 delete fb;
968 reader->setFocus(); 968 reader->setFocus();
969} 969}
970 970
971void QTReaderApp::showinfo() 971void QTReaderApp::showinfo()
972{ 972{
973 unsigned long fs, ts, pl; 973 unsigned long fs, ts, pl;
974 if (reader->empty()) 974 if (reader->empty())
975 { 975 {
976 QMessageBox::information(this, "QTReader", "No file loaded", 1); 976 QMessageBox::information(this, "OpieReader", "No file loaded", 1);
977 } 977 }
978 else 978 else
979 { 979 {
980 reader->sizes(fs,ts); 980 reader->sizes(fs,ts);
981 pl = reader->pagelocate(); 981 pl = reader->pagelocate();
982 m_infoWin->setFileSize(fs); 982 m_infoWin->setFileSize(fs);
983 m_infoWin->setTextSize(ts); 983 m_infoWin->setTextSize(ts);
984 m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); 984 m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts);
985 m_infoWin->setLocation(pl); 985 m_infoWin->setLocation(pl);
986 m_infoWin->setRead((100*pl + (ts >> 1))/ts); 986 m_infoWin->setRead((100*pl + (ts >> 1))/ts);
987 editorStack->raiseWidget( m_infoWin ); 987 editorStack->raiseWidget( m_infoWin );
988 m_infoWin->setFocus(); 988 m_infoWin->setFocus();
@@ -1011,25 +1011,25 @@ void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn)
1011 pBkmklist->push_front(Bkmk((const tchar*)text,posn)); 1011 pBkmklist->push_front(Bkmk((const tchar*)text,posn));
1012#endif 1012#endif
1013 m_fBkmksChanged = true; 1013 m_fBkmksChanged = true;
1014 pBkmklist->sort(); 1014 pBkmklist->sort();
1015} 1015}
1016 1016
1017void QTReaderApp::addAnno(const QString& name, const QString& text) 1017void QTReaderApp::addAnno(const QString& name, const QString& text)
1018{ 1018{
1019 if (m_annoIsEditing) 1019 if (m_annoIsEditing)
1020 { 1020 {
1021 if (name.isEmpty()) 1021 if (name.isEmpty())
1022 { 1022 {
1023 QMessageBox::information(this, "QTReader", "Need a name for the bookmark\nPlease try again", 1); 1023 QMessageBox::information(this, "OpieReader", "Need a name for the bookmark\nPlease try again", 1);
1024 } 1024 }
1025 else 1025 else
1026 { 1026 {
1027 addAnno(name, text, m_annoWin->getPosn()); 1027 addAnno(name, text, m_annoWin->getPosn());
1028 } 1028 }
1029 showEditTools(); 1029 showEditTools();
1030 } 1030 }
1031 else 1031 else
1032 { 1032 {
1033 if (m_annoWin->edited()) 1033 if (m_annoWin->edited())
1034 { 1034 {
1035 CBuffer buff(text.length()+1); 1035 CBuffer buff(text.length()+1);
@@ -1068,25 +1068,25 @@ bool QTReaderApp::findNextBookmark(size_t start)
1068 m_anno = iter.pContent(); 1068 m_anno = iter.pContent();
1069 } 1069 }
1070 break; 1070 break;
1071 } 1071 }
1072 } 1072 }
1073 return found; 1073 return found;
1074} 1074}
1075 1075
1076void QTReaderApp::addanno() 1076void QTReaderApp::addanno()
1077{ 1077{
1078 if (reader->empty()) 1078 if (reader->empty())
1079 { 1079 {
1080 QMessageBox::information(this, "QTReader", "No file loaded", 1); 1080 QMessageBox::information(this, "OpieReader", "No file loaded", 1);
1081 } 1081 }
1082 else 1082 else
1083 { 1083 {
1084 m_annoWin->setName(""); 1084 m_annoWin->setName("");
1085 m_annoWin->setAnno(""); 1085 m_annoWin->setAnno("");
1086 m_annoWin->setPosn(reader->pagelocate()); 1086 m_annoWin->setPosn(reader->pagelocate());
1087 m_annoIsEditing = true; 1087 m_annoIsEditing = true;
1088 editorStack->raiseWidget( m_annoWin ); 1088 editorStack->raiseWidget( m_annoWin );
1089 m_annoWin->setFocus(); 1089 m_annoWin->setFocus();
1090 } 1090 }
1091} 1091}
1092 1092
@@ -1222,40 +1222,40 @@ void QTReaderApp::settarget()
1222 do_regedit(); 1222 do_regedit();
1223} 1223}
1224 1224
1225void QTReaderApp::do_overlap(const QString& lcn) 1225void QTReaderApp::do_overlap(const QString& lcn)
1226{ 1226{
1227 bool ok; 1227 bool ok;
1228 unsigned long ulcn = lcn.toULong(&ok); 1228 unsigned long ulcn = lcn.toULong(&ok);
1229 if (ok) 1229 if (ok)
1230 { 1230 {
1231 reader->m_overlap = ulcn; 1231 reader->m_overlap = ulcn;
1232 } 1232 }
1233 else 1233 else
1234 QMessageBox::information(this, "QTReader", "Must be a number"); 1234 QMessageBox::information(this, "OpieReader", "Must be a number");
1235} 1235}
1236 1236
1237void QTReaderApp::do_mono(const QString& lcn) 1237void QTReaderApp::do_mono(const QString& lcn)
1238{ 1238{
1239 bool ok; 1239 bool ok;
1240 unsigned long ulcn = lcn.toULong(&ok); 1240 unsigned long ulcn = lcn.toULong(&ok);
1241 if (ok) 1241 if (ok)
1242 { 1242 {
1243 reader->m_charpc = ulcn; 1243 reader->m_charpc = ulcn;
1244 reader->setfont(); 1244 reader->setfont();
1245 reader->refresh(); 1245 reader->refresh();
1246 //reader->setmono(true); 1246 //reader->setmono(true);
1247 } 1247 }
1248 else 1248 else
1249 QMessageBox::information(this, "QTReader", "Must be a number"); 1249 QMessageBox::information(this, "OpieReader", "Must be a number");
1250} 1250}
1251 1251
1252/* 1252/*
1253void QTReaderApp::editPaste() 1253void QTReaderApp::editPaste()
1254{ 1254{
1255#ifndef QT_NO_CLIPBOARD 1255#ifndef QT_NO_CLIPBOARD
1256 editor->paste(); 1256 editor->paste();
1257#endif 1257#endif
1258} 1258}
1259*/ 1259*/
1260 1260
1261void QTReaderApp::editFind() 1261void QTReaderApp::editFind()
@@ -1409,25 +1409,25 @@ void QTReaderApp::openFile( const DocLnk &f )
1409 doc = new DocLnk(f); 1409 doc = new DocLnk(f);
1410 // QMessageBox::information(0, "DocLnk done", doc->file()); 1410 // QMessageBox::information(0, "DocLnk done", doc->file());
1411 // QMessageBox::information(0, "Progress", "Calling setText()"); 1411 // QMessageBox::information(0, "Progress", "Calling setText()");
1412 // QMessageBox::information(0, "Progress", "Textset"); 1412 // QMessageBox::information(0, "Progress", "Textset");
1413 1413
1414 // updateCaption(); 1414 // updateCaption();
1415 showEditTools(); 1415 showEditTools();
1416 reader->setText(doc->name(), doc->file()); 1416 reader->setText(doc->name(), doc->file());
1417 readbkmks(); 1417 readbkmks();
1418 } 1418 }
1419 else 1419 else
1420 { 1420 {
1421 QMessageBox::information(this, "QTReader", "File does not exist"); 1421 QMessageBox::information(this, "OpieReader", "File does not exist");
1422 } 1422 }
1423 1423
1424} 1424}
1425 1425
1426void QTReaderApp::showEditTools() 1426void QTReaderApp::showEditTools()
1427{ 1427{
1428 if ( !doc ) 1428 if ( !doc )
1429 close(); 1429 close();
1430// fileSelector->hide(); 1430// fileSelector->hide();
1431//tjw menu->show(); 1431//tjw menu->show();
1432 editBar->show(); 1432 editBar->show();
1433 if ( searchVisible ) 1433 if ( searchVisible )
@@ -1477,30 +1477,30 @@ void QTReaderApp::clear()
1477 { 1477 {
1478// QMessageBox::information(this, "QTReader", "Deleting doc", 1); 1478// QMessageBox::information(this, "QTReader", "Deleting doc", 1);
1479 delete doc; 1479 delete doc;
1480// QMessageBox::information(this, "QTReader", "Deleted doc", 1); 1480// QMessageBox::information(this, "QTReader", "Deleted doc", 1);
1481 doc = 0; 1481 doc = 0;
1482 } 1482 }
1483 reader->clear(); 1483 reader->clear();
1484} 1484}
1485 1485
1486void QTReaderApp::updateCaption() 1486void QTReaderApp::updateCaption()
1487{ 1487{
1488 if ( !doc ) 1488 if ( !doc )
1489 setCaption( tr("QTReader") ); 1489 setCaption( tr("OpieReader") );
1490 else { 1490 else {
1491 QString s = doc->name(); 1491 QString s = doc->name();
1492 if ( s.isEmpty() ) 1492 if ( s.isEmpty() )
1493 s = tr( "Unnamed" ); 1493 s = tr( "Unnamed" );
1494 setCaption( s + " - " + tr("QTReader") ); 1494 setCaption( s + " - " + tr("OpieReader") );
1495 } 1495 }
1496} 1496}
1497 1497
1498void QTReaderApp::setDocument(const QString& fileref) 1498void QTReaderApp::setDocument(const QString& fileref)
1499{ 1499{
1500 bFromDocView = TRUE; 1500 bFromDocView = TRUE;
1501//QMessageBox::information(0, "setDocument", fileref); 1501//QMessageBox::information(0, "setDocument", fileref);
1502 openFile(DocLnk(fileref)); 1502 openFile(DocLnk(fileref));
1503// showEditTools(); 1503// showEditTools();
1504} 1504}
1505 1505
1506void QTReaderApp::closeEvent( QCloseEvent *e ) 1506void QTReaderApp::closeEvent( QCloseEvent *e )
@@ -1523,25 +1523,25 @@ void QTReaderApp::closeEvent( QCloseEvent *e )
1523 regBar->hide(); 1523 regBar->hide();
1524 regVisible = false; 1524 regVisible = false;
1525 return; 1525 return;
1526 } 1526 }
1527 if (searchVisible) 1527 if (searchVisible)
1528 { 1528 {
1529 searchBar->hide(); 1529 searchBar->hide();
1530 searchVisible = false; 1530 searchVisible = false;
1531 return; 1531 return;
1532 } 1532 }
1533 if (m_fBkmksChanged && pBkmklist != NULL) 1533 if (m_fBkmksChanged && pBkmklist != NULL)
1534 { 1534 {
1535 if (QMessageBox::warning(this, "QTReader", "Save bookmarks?", "Save", "Don't bother") == 0) 1535 if (QMessageBox::warning(this, "OpieReader", "Save bookmarks?", "Save", "Don't bother") == 0)
1536 savebkmks(); 1536 savebkmks();
1537 delete pBkmklist; 1537 delete pBkmklist;
1538 pBkmklist = NULL; 1538 pBkmklist = NULL;
1539 m_fBkmksChanged = false; 1539 m_fBkmksChanged = false;
1540 } 1540 }
1541 bFromDocView = FALSE; 1541 bFromDocView = FALSE;
1542 saveprefs(); 1542 saveprefs();
1543 e->accept(); 1543 e->accept();
1544 } 1544 }
1545 else 1545 else
1546 { 1546 {
1547 showEditTools(); 1547 showEditTools();
@@ -1578,25 +1578,25 @@ void QTReaderApp::listbkmk()
1578 } 1578 }
1579 } 1579 }
1580 if (cnt > 0) 1580 if (cnt > 0)
1581 { 1581 {
1582//tjw menu->hide(); 1582//tjw menu->hide();
1583 editBar->hide(); 1583 editBar->hide();
1584 if (m_fontVisible) m_fontBar->hide(); 1584 if (m_fontVisible) m_fontBar->hide();
1585 if (regVisible) regBar->hide(); 1585 if (regVisible) regBar->hide();
1586 if (searchVisible) searchBar->hide(); 1586 if (searchVisible) searchBar->hide();
1587 editorStack->raiseWidget( bkmkselector ); 1587 editorStack->raiseWidget( bkmkselector );
1588 } 1588 }
1589 else 1589 else
1590 QMessageBox::information(this, "QTReader", "No bookmarks in memory"); 1590 QMessageBox::information(this, "OpieReader", "No bookmarks in memory");
1591} 1591}
1592 1592
1593void QTReaderApp::do_autogen() 1593void QTReaderApp::do_autogen()
1594{ 1594{
1595 m_nRegAction = cAutoGen; 1595 m_nRegAction = cAutoGen;
1596 regEdit->setText(m_autogenstr); 1596 regEdit->setText(m_autogenstr);
1597 do_regedit(); 1597 do_regedit();
1598} 1598}
1599 1599
1600void QTReaderApp::do_regedit() 1600void QTReaderApp::do_regedit()
1601{ 1601{
1602// editBar->hide(); 1602// editBar->hide();
@@ -1637,25 +1637,25 @@ void QTReaderApp::jump()
1637 sprintf(lcn, "%lu", reader->pagelocate()); 1637 sprintf(lcn, "%lu", reader->pagelocate());
1638 regEdit->setText(lcn); 1638 regEdit->setText(lcn);
1639 do_regedit(); 1639 do_regedit();
1640} 1640}
1641 1641
1642void QTReaderApp::do_jump(const QString& lcn) 1642void QTReaderApp::do_jump(const QString& lcn)
1643{ 1643{
1644 bool ok; 1644 bool ok;
1645 unsigned long ulcn = lcn.toULong(&ok); 1645 unsigned long ulcn = lcn.toULong(&ok);
1646 if (ok) 1646 if (ok)
1647 reader->locate(ulcn); 1647 reader->locate(ulcn);
1648 else 1648 else
1649 QMessageBox::information(this, "QTReader", "Must be a number"); 1649 QMessageBox::information(this, "OpieReader", "Must be a number");
1650} 1650}
1651 1651
1652void QTReaderApp::do_regaction() 1652void QTReaderApp::do_regaction()
1653{ 1653{
1654 regBar->hide(); 1654 regBar->hide();
1655 regVisible = false; 1655 regVisible = false;
1656 switch(m_nRegAction) 1656 switch(m_nRegAction)
1657 { 1657 {
1658 case cAutoGen: 1658 case cAutoGen:
1659 do_autogen(regEdit->text()); 1659 do_autogen(regEdit->text());
1660 break; 1660 break;
1661 case cAddBkmk: 1661 case cAddBkmk:
@@ -1677,25 +1677,25 @@ void QTReaderApp::do_regaction()
1677 reader->restore(); 1677 reader->restore();
1678// editBar->show(); 1678// editBar->show();
1679 reader->setFocus(); 1679 reader->setFocus();
1680} 1680}
1681 1681
1682void QTReaderApp::do_settarget(const QString& _txt) 1682void QTReaderApp::do_settarget(const QString& _txt)
1683{ 1683{
1684 int ind = _txt.find('/'); 1684 int ind = _txt.find('/');
1685 if (ind == -1) 1685 if (ind == -1)
1686 { 1686 {
1687 m_targetapp = ""; 1687 m_targetapp = "";
1688 m_targetmsg = ""; 1688 m_targetmsg = "";
1689 QMessageBox::information(this, "QTReader", "Format is\nappname/messagename"); 1689 QMessageBox::information(this, "OpieReader", "Format is\nappname/messagename");
1690 } 1690 }
1691 else 1691 else
1692 { 1692 {
1693 m_targetapp = _txt.left(ind); 1693 m_targetapp = _txt.left(ind);
1694 m_targetmsg = _txt.right(_txt.length()-ind-1); 1694 m_targetmsg = _txt.right(_txt.length()-ind-1);
1695 } 1695 }
1696} 1696}
1697 1697
1698void QTReaderApp::setfont() 1698void QTReaderApp::setfont()
1699{ 1699{
1700 for (int i = 1; i <= m_fontSelector->count(); i++) 1700 for (int i = 1; i <= m_fontSelector->count(); i++)
1701 { 1701 {
@@ -1912,25 +1912,25 @@ void QTReaderApp::readbkmks()
1912 1912
1913void QTReaderApp::addbkmk() 1913void QTReaderApp::addbkmk()
1914{ 1914{
1915 m_nRegAction = cAddBkmk; 1915 m_nRegAction = cAddBkmk;
1916 regEdit->setText(reader->firstword()); 1916 regEdit->setText(reader->firstword());
1917 do_regedit(); 1917 do_regedit();
1918} 1918}
1919 1919
1920void QTReaderApp::do_addbkmk(const QString& text) 1920void QTReaderApp::do_addbkmk(const QString& text)
1921{ 1921{
1922 if (text.isEmpty()) 1922 if (text.isEmpty())
1923 { 1923 {
1924 QMessageBox::information(this, "QTReader", "Need a name for the bookmark\nSelect add again", 1); 1924 QMessageBox::information(this, "OpieReader", "Need a name for the bookmark\nSelect add again", 1);
1925 } 1925 }
1926 else 1926 else
1927 { 1927 {
1928 if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>; 1928 if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>;
1929#ifdef _UNICODE 1929#ifdef _UNICODE
1930 CBuffer buff; 1930 CBuffer buff;
1931 int i = 0; 1931 int i = 0;
1932 for (i = 0; i < text.length(); i++) 1932 for (i = 0; i < text.length(); i++)
1933 { 1933 {
1934 buff[i] = text[i].unicode(); 1934 buff[i] = text[i].unicode();
1935 } 1935 }
1936 buff[i] = 0; 1936 buff[i] = 0;