Remove dead code

A lot of this code has been commented out for over
a decade and adds no value to the project.
It is only annoying when you look over it ;).

Same for the KNS2 support which was commented out.

Also some of the debug statements didn't even build
anymore, because the properties got removed/refactored.
This commit is contained in:
Alexander Lohnau 2020-11-13 21:10:49 +01:00
parent 6bd6714ab0
commit 3c1fa441d9
17 changed files with 1 additions and 435 deletions

View file

@ -1906,12 +1906,6 @@ QVariant DocumentPrivate::documentMetaData(const Generator::DocumentMetaDataKey
case SettingsCore::EnumTextAntialias::Enabled:
return true;
break;
#if 0
case Settings::EnumTextAntialias::UseKDESettings:
// TODO: read the KDE configuration
return true;
break;
#endif
case SettingsCore::EnumTextAntialias::Disabled:
return false;
break;

View file

@ -877,19 +877,6 @@ void PagePrivate::saveLocalContents(QDomNode &parentNode, QDomDocument &document
QDomElement pageElement = document.createElement(QStringLiteral("page"));
pageElement.setAttribute(QStringLiteral("number"), m_number);
#if 0
// add bookmark info if is bookmarked
if ( d->m_bookmarked )
{
// create the pageElement's 'bookmark' child
QDomElement bookmarkElement = document.createElement( "bookmark" );
pageElement.appendChild( bookmarkElement );
// add attributes to the element
//bookmarkElement.setAttribute( "name", bookmark name );
}
#endif
// add annotations info if has got any
if ((what & AnnotationPageItems) && (what & OriginalAnnotationPageItems)) {
const QDomElement savedDocRoot = restoredLocalAnnotationList.documentElement();

View file

@ -103,17 +103,6 @@ ExecutorKJS::~ExecutorKJS()
void ExecutorKJS::execute(const QString &script, Event *event)
{
#if 0
QString script2;
QString errMsg;
int errLine;
if ( !KJSInterpreter::normalizeCode( script, &script2, &errLine, &errMsg ) )
{
qCWarning(OkularCoreDebug) << "Parse error during normalization!";
script2 = script;
}
#endif
KJSContext *ctx = d->m_interpreter->globalContext();
d->m_docObject.setProperty(ctx, QStringLiteral("event"), event ? JSEvent::wrapEvent(ctx, event) : KJSUndefined());

View file

@ -50,12 +50,6 @@ void Scripter::execute(ScriptType type, const QString &script)
{
qCDebug(OkularCoreDebug) << "executing the script:";
#ifdef WITH_KJS
#if 0
if ( script.length() < 1000 )
qDebug() << script;
else
qDebug() << script.left( 1000 ) << "[...]";
#endif
static QString builtInScript;
if (builtInScript.isNull()) {
QFile builtInResource(QStringLiteral(":/script/builtin.js"));

View file

@ -5605,24 +5605,7 @@ SYNCTEX_INLINE static synctex_status_t _synctex_post_process(synctex_scanner_p s
printf("! ref replaced in sheet _synctex_post_process.\n");
synctex_node_display(scanner->sheet);
#endif
#if 0
{
int i;
for (i=0;i<scanner->number_of_lists;++i) {
synctex_node_p P = ns.node;
do {
synctex_node_p N = scanner->lists_of_friends[i];
do {
if (P == N) {
printf("Already registered.\n");
synctex_node_display(N);
break;
}
} while ((N = _synctex_tree_friend(N)));
} while((P = _synctex_tree_friend(P)));
}
}
#endif
#if defined SYNCTEX_DEBUG && SYNCTEX_DEBUG > 10000
{
int i;
@ -7888,67 +7871,6 @@ SYNCTEX_INLINE static synctex_nd_lr_s __synctex_eq_get_closest_children_in_hbox_
return nds;
}
#if 0
SYNCTEX_INLINE static synctex_nd_lr_s __synctex_eq_get_closest_children_in_hbox_v3(synctex_point_p hitP, synctex_node_p nodeP) {
synctex_nd_s nd = SYNCTEX_ND_0;
synctex_nd_lr_s nds = {SYNCTEX_ND_0,SYNCTEX_ND_0};
if ((nd.node = _synctex_tree_child(nodeP))) {
do {
nd = _synctex_point_h_ordered_distance_v2(hitP,nd.node);
if (nd.distance > 0) {
/* node is to the right of the hit point.
* We compare node and the previously recorded one, through the recorded distance.
* If the nodes have the same tag, prefer the one with the smallest line number,
* if the nodes also have the same line number, prefer the one with the smallest column. */
if (nds.r.distance > nd.distance) {
nds.r = nd;
} else if (nds.r.distance == nd.distance && nds.r.node) {
if (_synctex_data_tag(nds.r.node) == _synctex_data_tag(nd.node)
&& (_synctex_data_line(nds.r.node) > _synctex_data_line(nd.node)
|| (_synctex_data_line(nds.r.node) == _synctex_data_line(nd.node)
&& _synctex_data_column(nds.r.node) > _synctex_data_column(nd.node)))) {
nds.r = nd;
}
}
} else if (nd.distance == 0) {
/* hit point is inside node. */
nds.l = nd;
} else { /* here nd.d < 0, the hit point is to the right of node */
nd.distance = -nd.distance;
if (nds.l.distance > nd.distance) {
nds.l = nd;
} else if (nds.l.distance == nd.distance && nds.l.node) {
if (_synctex_data_tag(nds.l.node) == _synctex_data_tag(nd.node)
&& (_synctex_data_line(nds.l.node) > _synctex_data_line(nd.node)
|| (_synctex_data_line(nds.l.node) == _synctex_data_line(nd.node)
&& _synctex_data_column(nds.l.node) > _synctex_data_column(nd.node)))) {
nds.l = nd;
}
}
}
} while((nd.node = __synctex_tree_sibling(nd.node)));
if (nds.l.node) {
/* the left node is new, try to narrow the result */
if ((nd.node = _synctex_eq_deepest_container_v2(hitP,nds.l.node))) {
nds.l.node = nd.node;
}
if((nd = _synctex_eq_closest_child_v2(hitP,nds.l.node)).node) {
nds.l.node = nd.node;
}
}
if (nds.r.node) {
/* the right node is new, try to narrow the result */
if ((nd.node = _synctex_eq_deepest_container_v2(hitP,nds.r.node))) {
nds.r.node = nd.node;
}
if((nd = _synctex_eq_closest_child_v2(hitP,nds.r.node)).node) {
nds.r.node = nd.node;
}
}
}
return nds;
}
#endif
SYNCTEX_INLINE static synctex_nd_lr_s __synctex_eq_get_closest_children_in_vbox_v2(synctex_point_p hitP, synctex_node_p nodeP)
{
(void)nodeP; /* unused */

View file

@ -345,105 +345,6 @@ RegularAreaRect *TextPage::textArea(TextSelection *sel) const
PagePrivate *pagePrivate = PagePrivate::get(d->m_page);
const QTransform matrix = pagePrivate ? pagePrivate->rotationMatrix() : QTransform();
#if 0
int it = -1;
int itB = -1;
int itE = -1;
// ending cursor is higher than start cursor, we need to find positions in reverse
NormalizedRect tmp;
NormalizedRect start;
NormalizedRect end;
NormalizedPoint startC = sel->start();
double startCx = startC.x;
double startCy = startC.y;
NormalizedPoint endC = sel->end();
double endCx = endC.x;
double endCy = endC.y;
if ( sel->direction() == 1 || ( sel->itB() == -1 && sel->direction() == 0 ) )
{
#ifdef DEBUG_TEXTPAGE
qCWarning(OkularCoreDebug) << "running first loop";
#endif
const int count = d->m_words.count();
for ( it = 0; it < count; it++ )
{
tmp = *d->m_words[ it ]->area();
if ( tmp.contains( startCx, startCy )
|| ( tmp.top <= startCy && tmp.bottom >= startCy && tmp.left >= startCx )
|| ( tmp.top >= startCy))
{
/// we have found the (rx,ry)x(tx,ty)
itB = it;
#ifdef DEBUG_TEXTPAGE
qCWarning(OkularCoreDebug) << "start is" << itB << "count is" << d->m_words.count();
#endif
break;
}
}
sel->itB( itB );
}
itB = sel->itB();
#ifdef DEBUG_TEXTPAGE
qCWarning(OkularCoreDebug) << "direction is" << sel->direction();
qCWarning(OkularCoreDebug) << "reloaded start is" << itB << "against" << sel->itB();
#endif
if ( sel->direction() == 0 || ( sel->itE() == -1 && sel->direction() == 1 ) )
{
#ifdef DEBUG_TEXTPAGE
qCWarning(OkularCoreDebug) << "running second loop";
#endif
for ( it = d->m_words.count() - 1; it >= itB; it-- )
{
tmp = *d->m_words[ it ]->area();
if ( tmp.contains( endCx, endCy )
|| ( tmp.top <= endCy && tmp.bottom >= endCy && tmp.right <= endCx )
|| ( tmp.bottom <= endCy ) )
{
/// we have found the (ux,uy)x(vx,vy)
itE = it;
#ifdef DEBUG_TEXTPAGE
qCWarning(OkularCoreDebug) << "ending is" << itE << "count is" << d->m_words.count();
qCWarning(OkularCoreDebug) << "conditions" << tmp.contains( endCx, endCy ) << " "
<< ( tmp.top <= endCy && tmp.bottom >= endCy && tmp.right <= endCx ) << " " <<
( tmp.top >= endCy);
#endif
break;
}
}
sel->itE( itE );
}
#ifdef DEBUG_TEXTPAGE
qCWarning(OkularCoreDebug) << "reloaded ending is" << itE << "against" << sel->itE();
#endif
if ( sel->itB() != -1 && sel->itE() != -1 )
{
start = *d->m_words[ sel->itB() ]->area();
end = *d->m_words[ sel->itE() ]->area();
NormalizedRect first, second, third;
/// finding out if there is more than one baseline between them is a hard and discussable task
/// we will create a rectangle (rx,0)x(tx,1) and will check how many times does it intersect the
/// areas, if more than one -> we have a three or over line selection
first = start;
second.top = start.bottom;
first.right = second.right = 1;
third = end;
third.left = second.left = 0;
second.bottom = end.top;
int selMax = qMax( sel->itB(), sel->itE() );
for ( it = qMin( sel->itB(), sel->itE() ); it <= selMax; ++it )
{
tmp = *d->m_words[ it ]->area();
if ( tmp.intersects( &first ) || tmp.intersects( &second ) || tmp.intersects( &third ) )
ret->appendShape( d->m_words.at( it )->transformedArea( matrix ) );
}
}
#else
const double scaleX = d->m_page->width();
const double scaleY = d->m_page->height();
@ -685,8 +586,6 @@ RegularAreaRect *TextPage::textArea(TextSelection *sel) const
ret->appendShape((*start)->transformedArea(matrix), side);
}
#endif
return ret;
}

View file

@ -195,9 +195,6 @@ Okular::TextPage *DjVuGenerator::textPage(Okular::TextRequest *request)
userMutex()->lock();
const Okular::Page *page = request->page();
QList<KDjVu::TextEntity> te;
#if 0
m_djvu->textEntities( page->number(), "char" );
#endif
if (te.isEmpty())
te = m_djvu->textEntities(page->number(), QStringLiteral("word"));
if (te.isEmpty())

View file

@ -83,17 +83,6 @@ dviRenderer::~dviRenderer()
delete dviFile;
}
#if 0
void dviRenderer::setPrefs(bool flag_showPS, const QString &str_editorCommand, bool useFontHints )
{
//QMutexLocker locker(&mutex);
_postscript = flag_showPS;
editorCommand = str_editorCommand;
font_pool.setParameters( useFontHints );
}
#endif
//------ this function calls the dvi interpreter ----------
void dviRenderer::drawPage(RenderedDocumentPagePixmap *page)
@ -213,22 +202,6 @@ void dviRenderer::drawPage(RenderedDocumentPagePixmap *page)
currentlyDrawnPage = nullptr;
return;
}
#if 0
// Tell the user (once) if the DVI file contains source specials
// ... we don't want our great feature to go unnoticed.
RenderedDviPagePixmap* currentDVIPage = dynamic_cast<RenderedDviPagePixmap*>(currentlyDrawnPage);
if (currentDVIPage)
{
if ((dviFile->sourceSpecialMarker == true) && (currentDVIPage->sourceHyperLinkList.size() > 0)) {
dviFile->sourceSpecialMarker = false;
// Show the dialog as soon as event processing is finished, and
// the program is idle
//FIXME
//QTimer::singleShot( 0, this, SLOT(showThatSourceInformationIsPresent()) );
}
}
#endif
currentlyDrawnPage = nullptr;
}
@ -519,26 +492,6 @@ bool dviRenderer::setFile(const QString &fname, const QUrl &base)
}
PostScriptOutPutString = nullptr;
#if 0
// Generate the list of bookmarks
bookmarks.clear();
Q3PtrStack<Bookmark> stack;
stack.setAutoDelete (false);
QVector<PreBookmark>::iterator it;
for( it = prebookmarks.begin(); it != prebookmarks.end(); ++it ) {
Bookmark *bmk = new Bookmark((*it).title, findAnchor((*it).anchorName));
if (stack.isEmpty())
bookmarks.append(bmk);
else {
stack.top()->subordinateBookmarks.append(bmk);
stack.remove();
}
for(int i=0; i<(*it).noOfChildren; i++)
stack.push(bmk);
}
prebookmarks.clear();
#endif
#ifdef PERFORMANCE_MEASUREMENT
// qCDebug(OkularDviDebug) << "Time required for prescan phase: " << preScanTimer.restart() << "ms";
#endif
@ -660,11 +613,6 @@ void dviRenderer::handleSRCLink(const QString &linkText, const QPoint point, Doc
Q_UNUSED(linkText);
Q_UNUSED(point);
Q_UNUSED(widget);
#if 0
QExplicitlySharedDataPointer<DVISourceEditor> editor(new DVISourceEditor(*this, parentWidget, linkText, point, win));
if (editor->started())
editor_ = editor;
#endif
}
QString dviRenderer::PDFencodingToQString(const QString &_pdfstring)

View file

@ -103,12 +103,6 @@ public:
dvifile *dviFile;
#if 0
bool isModified() const {return _isModified;};
void setPrefs(bool flag_showPS, const QString &editorCommand, bool useFontHints );
#endif
virtual bool supportsTextSearch() const
{
return true;

View file

@ -617,32 +617,10 @@ void dviRenderer::draw_page()
qCDebug(OkularDviDebug) << "draw_page";
#endif
#if 0
if (!accessibilityBackground)
{
#endif
foreGroundPainter->fillRect(foreGroundPainter->viewport(), PS_interface->getBackgroundColor(current_page));
#if 0
}
else
{
// In accessibility mode use the custom background color
foreGroundPainter->fillRect( foreGroundPainter->viewport(), accessibilityBackgroundColor );
}
#endif
// Render the PostScript background, if there is one.
if (_postscript) {
#if 0
// In accessibility mode use the custom background color
if (accessibilityBackground)
{
// Flag permanent is set to false because otherwise we would not be able to restore
// the original background color.
PS_interface->setBackgroundColor(current_page, accessibilityBackgroundColor, false);
}
else
#endif
PS_interface->restoreBackgroundColor(current_page);
PS_interface->graphics(current_page, resolutionInDPI, dviFile->getMagnification(), foreGroundPainter);

View file

@ -266,13 +266,6 @@ Okular::TextPage *DviGenerator::extractTextFromPage(dviPageInfo *pageInfo)
for (; it != itEnd; ++it) {
TextBox curTB = *it;
#if 0
qCDebug(OkularDviDebug) << "orientation: " << orientation
<< ", curTB.box: " << curTB.box
<< ", ( " << pageWidth << "," << pageHeight << " )"
<<endl;
#endif
textOfThePage.push_back(new Okular::TextEntity(curTB.text, new Okular::NormalizedRect(curTB.box, pageWidth, pageHeight)));
}

View file

@ -266,24 +266,6 @@ void ghostscript_interface::gs_generate_graphics_file(const PageNumber page, con
"any of the Ghostview device drivers that are known to Okular. PostScript "
"support has therefore been turned off in Okular."),
-1);
#if 0
i18n("<qt><p>The Ghostview program, which Okular uses internally to display the "
"PostScript graphics that is included in this DVI file, is generally able to "
"write its output in a variety of formats. The sub-programs that Ghostview uses "
"for these tasks are called 'device drivers'; there is one device driver for "
"each format that Ghostview is able to write. Different versions of Ghostview "
"often have different sets of device drivers available. It seems that the "
"version of Ghostview that is installed on this computer does not contain "
"<strong>any</strong> of the device drivers that are known to Okular.</p>"
"<p>It seems unlikely that a regular installation of Ghostview would not contain "
"these drivers. This error may therefore point to a serious misconfiguration of "
"the Ghostview installation on your computer.</p>"
"<p>If you want to fix the problems with Ghostview, you can use the command "
"<strong>gs --help</strong> to display the list of device drivers contained in "
"Ghostview. Among others, Okular can use the 'png256', 'jpeg' and 'pnm' "
"drivers. Note that Okular needs to be restarted to re-enable PostScript support."
"</p></qt>"));
#endif
else {
qCDebug(OkularDviDebug) << QStringLiteral("Okular will now try to use the '%1' device driver.").arg(*gsDevice);
gs_generate_graphics_file(page, filename, magnification);

View file

@ -904,51 +904,6 @@ bool QUnpluck::TranscribeTextRecord(plkr_Document *doc, int id, Context *context
// current_alignment = (*ptr) + 1;
}
} else if (fctype == PLKR_TFC_MARGINS) {
/* Not easy to set, in HTML */
#if 0
output += QString( "<!-- margins: %1, %2 -->" ).arg(ptr[0], ptr[1]);
if (current_left_margin != ptr[0]
|| current_right_margin != ptr[1]) {
if (current_right_margin != 0)
fprintf (fp, "</td><td width=%d>&nbsp;",
current_right_margin);
fprintf (fp, "</td></tr></table>\n");
}
current_left_margin = ptr[0];
current_right_margin = ptr[1];
if (current_right_margin > 0
|| current_left_margin > 0) {
fprintf (fp, "<table border=1><tr>");
if (current_left_margin != 0) {
fprintf (fp, "<td width=%d align=right>",
current_left_margin);
if ((ptr - run) > 2) {
fwrite (run, 1, ((ptr - 2) - run), fp);
textlen += ((ptr - 2) - run);
}
else {
fprintf (fp, "&nbsp;");
}
fprintf (fp, "</td>");
}
fprintf (fp, "<td>");
if (current_left_margin == 0 && (ptr - run) > 2) {
fwrite (run, 1, ((ptr - 2) - run), fp);
textlen += ((ptr - 2) - run);
}
}
else {
if ((ptr - run) > 2) {
fwrite (run, 1, ((ptr - 2) - run), fp);
textlen += ((ptr - 2) - run);
}
}
#endif
// current_left_margin = ptr[0];
// current_right_margin = ptr[1];
} else if (fctype == PLKR_TFC_COLOR) {
/* not sure what to do here yet */
/*
@ -981,10 +936,6 @@ bool QUnpluck::TranscribeTextRecord(plkr_Document *doc, int id, Context *context
context->cursor->insertText(QChar((ptr[3] << 8) + ptr[4]));
/* skip over alternate text */
ptr += ptr[0];
} else {
/* ignore function */
// output += QString( "<!-- function code %1 ignored -->" ).arg(fctype);
}
ptr += fclen;
@ -1023,20 +974,6 @@ bool QUnpluck::TranscribeTextRecord(plkr_Document *doc, int id, Context *context
format.setFontStrikeOut(false);
context->cursor->setCharFormat(format);
}
#if 0
if (current_alignment > 0) {
context->cursor->insertBlock();
}
if (current_right_margin > 0)
fprintf (fp, "</td><td width=%d>&nbsp;</td></tr></table>",
current_right_margin);
else if (current_left_margin > 0)
fprintf (fp, "</td></tr></table>");
/* end the paragraph */
context->cursor->insertBlock();
#endif
}
free(paragraphs);
return true;

View file

@ -280,13 +280,6 @@ GetUncompressedRecord(plkr_Document *doc, plkr_DBHandle handle, int record_index
return FALSE;
}
#if 0
_plkr_message
("data record %d (%d): uid is %d, # paras = %d, size = %d, type = %d",
record_index, record->size, (buf[0] << 8) + buf[1],
(buf[2] << 8) + buf[3], (buf[4] << 8) + buf[5], buf[6]);
#endif
memcpy(tbuffer, buf, 8);
output_ptr = tbuffer + 8;
buffer_remaining = blen - 8;

View file

@ -77,10 +77,6 @@
#include <PurposeWidgets/Menu>
#endif
#if 0
#include <knewstuff2/engine.h>
#endif
// local includes
#include "aboutdata.h"
#include "conf/preferencesdialog.h"
@ -904,12 +900,6 @@ void Part::setupActions()
importPS->setText(i18n("&Import PostScript as PDF..."));
importPS->setIcon(QIcon::fromTheme(QStringLiteral("document-import")));
connect(importPS, &QAction::triggered, this, &Part::slotImportPSFile);
#if 0
QAction * ghns = ac->addAction("get_new_stuff");
ghns->setText(i18n("&Get Books From Internet..."));
ghns->setIcon(QIcon::fromTheme("get-hot-new-stuff"));
connect(ghns, SIGNAL(triggered()), this, SLOT(slotGetNewStuff()));
#endif
KToggleAction *blackscreenAction = new KToggleAction(i18n("Switch Blackscreen Mode"), ac);
ac->addAction(QStringLiteral("switch_blackscreen_mode"), blackscreenAction);
@ -2758,17 +2748,6 @@ void Part::checkNativeSaveDataLoss(bool *out_wontSaveForms, bool *out_wontSaveAn
*out_wontSaveAnnotations = wontSaveAnnotations;
}
void Part::slotGetNewStuff()
{
#if 0
KNS::Engine engine(widget());
engine.init( "okular.knsrc" );
// show the modal dialog over pageview and execute it
KNS::Entry::List entries = engine.downloadDialogModal( m_pageView );
Q_UNUSED( entries )
#endif
}
void Part::slotPreferences()
{
// Create dialog

1
part.h
View file

@ -214,7 +214,6 @@ protected Q_SLOTS:
void slotFindNext();
void slotFindPrev();
bool slotSaveFileAs(bool showOkularArchiveAsDefaultFormat = false);
void slotGetNewStuff();
void slotNewConfig();
void slotShowMenu(const Okular::Page *page, const QPoint point);
void slotShowTOCMenu(const Okular::DocumentViewport &vp, const QPoint point, const QString &title);

View file

@ -2428,25 +2428,6 @@ void PageView::mouseReleaseEvent(QMouseEvent *e)
}
}
}
#if 0
else
{
// a link can move us to another page or even to another document, there's no point in trying to
// process the click on the image once we have processes the click on the link
rect = pageItem->page()->objectRect( Okular::ObjectRect::Image, nX, nY, pageItem->width(), pageItem->height() );
if ( rect )
{
// handle click over a image
}
/* Enrico and me have decided this is not worth the trouble it generates
else
{
// if not on a rect, the click selects the page
// if ( pageItem->pageNumber() != (int)d->document->currentPage() )
d->document->setViewportPage( pageItem->pageNumber(), this );
}*/
}
#endif
} else if (rightButton && !d->mouseAnnotation->isModified()) {
if (pageItem && pageItem == pageItemPressPos && ((d->mousePressPos - e->globalPos()).manhattanLength() < QApplication::startDragDistance())) {
QMenu *menu = createProcessLinkMenu(pageItem, eventPos);