[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/klipper
From:       Waldo Bastian <bastian () kde ! org>
Date:       2003-01-31 21:08:19
[Download RAW message or body]

CVS commit by waba: 

Two new dcop functions:
+    QStringList getClipboardHistoryMenu();
+    QString getClipboardHistoryItem(int i);


  M +35 -0     toplevel.cpp   1.120
  M +2 -0      toplevel.h   1.40


--- kdebase/klipper/toplevel.cpp  #1.119:1.120
@@ -731,4 +731,39 @@ void KlipperWidget::setClipboard( const 
 }
 
+QStringList KlipperWidget::getClipboardHistoryMenu()
+{ 
+    QStringList menu;
+    if ( !bClipEmpty )
+    {
+        // don't iterate over the map, but over the popup (due to sorting!)
+        long id = 0L;
+        // We skip the title and start at 1
+        for ( uint i = 1; i < m_popup->count(); i++ ) 
+        {
+            id = m_popup->idAt( i );
+            if ( id != -1 ) 
+            {
+                QMapIterator<long,QString> it = m_clipDict.find( id );
+                if ( it == m_clipDict.end() )
+                    break; // End of clipboard entries
+                menu << m_popup->text(id);
+            }
+        }
+    }
+    return menu;
+}
+
+QString KlipperWidget::getClipboardHistoryItem(int i)
+{
+    if ( !bClipEmpty )
+    {
+        long id = m_popup->idAt( i+1 ); // Add 1 to skip title
+        QMapIterator<long,QString> it = m_clipDict.find( id );
+        if ( it != m_clipDict.end() )
+            return it.data();
+    }
+    return QString::null;
+}
+
 //
 // changing a spinbox in klipper's config-dialog causes the lineedit-contents

--- kdebase/klipper/toplevel.h  #1.39:1.40
@@ -34,4 +34,6 @@ k_dcop:
     void setClipboardContents(QString s);
     void clearClipboardContents();
+    QStringList getClipboardHistoryMenu();
+    QString getClipboardHistoryItem(int i);
 
 public:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic