You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
784 B
44 lines
784 B
// selection.cpp |
|
// |
|
// (C) 2001 Stefan Kebekus |
|
// Distributed under the GPL |
|
|
|
#include <kdebug.h> |
|
#include <qapplication.h> |
|
#include <qclipboard.h> |
|
#include <selection.h> |
|
|
|
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); |
|
}
|
|
|