[Kstars-devel] KDE/kdeedu/kstars/kstars/tools

Jasem Mutlaq mutlaqja at ikarustech.com
Sat Aug 28 21:29:49 CEST 2010


SVN commit 1169242 by mutlaqja:

Add ability to remove items from observing list by pressing delete.

CCMAIL: kstars-devel at kde.org



 M  +19 -1     observinglist.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/tools/observinglist.cpp #1169241:1169242
@@ -97,6 +97,7 @@
     setCaption( i18n( "Observing List" ) );
     setButtons( KDialog::Close );
     dt = KStarsDateTime::currentDateTime();
+    setFocusPolicy(Qt::StrongFocus);
     geo = ks->data()->geo();
     sessionView = false;
     nativeSave = true;
@@ -136,7 +137,9 @@
     ui->SetLocation->setText( geo -> fullName() );
     ui->ImagePreview->installEventFilter( this );
     ui->TableView->viewport()->installEventFilter( this );
+    ui->TableView->installEventFilter( this );
     ui->SessionView->viewport()->installEventFilter( this );
+    ui->SessionView->installEventFilter( this );
     // setDefaultImage();
     //Connections
     connect( this, SIGNAL( closeClicked() ), this, SLOT( slotClose() ) );
@@ -1235,7 +1238,8 @@
             }
         }
     }
-    if( obj == ui->SessionView->viewport() && ! noSelection ) {
+
+    if( obj == ui->TableView->viewport() && ! noSelection ) {
         if( event->type() == QEvent::MouseButtonRelease ) {
             QMouseEvent *mouseEvent = static_cast<QMouseEvent* >(event);
             if( mouseEvent->button() == Qt::RightButton ) {
@@ -1249,9 +1253,22 @@
             }
         }
     }
+
+    if( obj == ui->TableView || obj == ui->SessionView)
+    {
+        if (event->type() == QEvent::KeyPress)
+        {
+                QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+                if (keyEvent->key() == Qt::Key_Delete)
+                    slotRemoveSelectedObjects();
+                return true;
+         } else
     return false;
 }
 
+    return false;
+}
+
 void ObservingList::slotGoogleImage() {
     QPixmap *pm = new QPixmap;
     QPointer<ThumbnailPicker> tp = new ThumbnailPicker( currentObject(), *pm, this, 600, 600, i18n( "Image Chooser" ) );
@@ -1333,4 +1350,5 @@
     } else
         ui->ImagePreview->hide();
 }
+
 #include "observinglist.moc"


More information about the Kstars-devel mailing list