mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-13 03:12:22 +00:00
a6e15030d4
svn path=/trunk/kdegraphics/kdvi/; revision=207275
48 lines
861 B
C++
48 lines
861 B
C++
// selection.cpp
|
|
//
|
|
// Part of KDVI - A previewer for TeX DVI files.
|
|
//
|
|
// (C) 2001 Stefan Kebekus
|
|
// Distributed under the GPL
|
|
|
|
#include <kdebug.h>
|
|
#include <qapplication.h>
|
|
#include <qclipboard.h>
|
|
#include "selection.h"
|
|
#include "selection.moc"
|
|
|
|
selection::selection(void)
|
|
{
|
|
act = 0;
|
|
clear();
|
|
}
|
|
|
|
selection::~selection(void)
|
|
{
|
|
}
|
|
|
|
void selection::set(Q_INT32 start, Q_INT32 end, QString text)
|
|
{
|
|
selectedTextStart = start;
|
|
selectedTextEnd = end;
|
|
selectedText = text;
|
|
|
|
QApplication::clipboard()->setSelectionMode(true);
|
|
QApplication::clipboard()->setText(selectedText);
|
|
|
|
if (act != 0)
|
|
act->setEnabled(!selectedText.isEmpty());
|
|
}
|
|
|
|
void selection::setAction(KAction *a)
|
|
{
|
|
act = a;
|
|
if (act != 0)
|
|
act->setEnabled(!selectedText.isEmpty());
|
|
}
|
|
|
|
void selection::clear(void)
|
|
{
|
|
set(-1, -1, QString::null);
|
|
}
|