[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdebase/klipper
From: Esben Mose Hansen <kde () mosehansen ! dk>
Date: 2004-11-26 17:37:09
Message-ID: 20041126173709.BD64817A2B () office ! kde ! org
[Download RAW message or body]
CVS commit by esben:
The wrong clipboard/selection was set by the prevent-empty-clipboard feature
Image items were not set correctly if a text item was current
set in the clipboard.
M +17 -5 toplevel.cpp 1.167
M +9 -2 toplevel.h 1.58
--- kdebase/klipper/toplevel.cpp #1.166:1.167
@@ -720,5 +720,5 @@ void KlipperWidget::checkClipData( bool
const HistoryItem* top = history()->first();
if ( top ) {
- setClipboard( *top, selectionMode );
+ setClipboard( *top, selectionMode ? Selection : Clipboard);
}
return;
@@ -748,5 +748,5 @@ void KlipperWidget::checkClipData( bool
<< "\nserialNo=" << clip->data()->serialNumber() << " (sel,cli)=(" << \
m_lastSelection << "," << m_lastClipboard << ")"
<< "\nowning (sel,cli)=(" << clip->ownsSelection() << "," << \
clip->ownsClipboard() << ")"
- << "\ntext=" << clip->text() << endl;
+ << "\ntext=" << clip->text( selectionMode ? QClipboard::Selection : \
QClipboard::Clipboard) << endl;
#endif
@@ -773,6 +773,10 @@ void KlipperWidget::checkClipData( bool
if ( top ) {
// keep old clipboard after someone set it to null
- setClipboard( *top, selectionMode );
+#ifdef NOISY_KLIPPER
+ kdDebug() << "Resetting clipboard (Prevent empty clipboard)" << endl;
+#endif
+ setClipboard( *top, selectionMode ? Selection : Clipboard );
}
+ return;
}
@@ -820,6 +824,11 @@ void KlipperWidget::setClipboard( const
Ignore lock( locklevel );
+ Q_ASSERT( ( mode & 1 ) == 0 ); // Warn if trying to pass a boolean as a mode.
+
if ( mode & Selection ) {
- if ( clip->image().isNull() ) {
+#ifdef NOSIY_KLIPPER
+ kdDebug() << "Setting selection to <" << item.text() << ">" << endl;
+#endif
+ if ( item.image().isNull() ) {
clip->setText( item.text(), QClipboard::Selection );
} else {
@@ -829,5 +838,8 @@ void KlipperWidget::setClipboard( const
}
if ( mode & Clipboard ) {
- if ( clip->image().isNull() ) {
+#ifdef NOSIY_KLIPPER
+ kdDebug() << "Setting clipboard to <" << item.text() << ">" << endl;
+#endif
+ if ( item.image().isNull() ) {
clip->setText( item.text(), QClipboard::Clipboard );
} else {
--- kdebase/klipper/toplevel.h #1.57:1.58
@@ -78,4 +78,12 @@ public slots:
protected:
+ /**
+ * The selection modes
+ *
+ * Don't use 1, as I use that as a guard against passing
+ * a boolean true as a mode.
+ */
+ enum SelectionMode { Clipboard = 2, Selection = 4 };
+
void paintEvent(QPaintEvent *);
void mousePressEvent(QMouseEvent *);
@@ -148,5 +156,4 @@ private slots:
private:
- enum SelectionMode { Clipboard = 1, Selection = 2 };
QClipboard *clip;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic