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

List:       kde-commits
Subject:    extragear/office/datakiosk/src
From:       Adam Treat <manyoso () yahoo ! com>
Date:       2005-05-09 3:55:36
Message-ID: 1115610936.764069.30477.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 411381 by treat:

* Change the color of the selection to match the
status of the current record.  Green means the display
matches the database and red means that something has
been altered.
* Add a couple of icons for the insert/delete actions.


 M  +16 -4     trunk/extragear/office/datakiosk/src/datatableview.cpp  
 M  +3 -1      trunk/extragear/office/datakiosk/src/datatableview.h  
 M  +8 -8      trunk/extragear/office/datakiosk/src/project.cpp  


--- trunk/extragear/office/datakiosk/src/datatableview.cpp #411380:411381
@@ -18,6 +18,7 @@
 #include "databaseconnection.h"
 
 #include <qstyle.h>
+#include <qcolor.h>
 #include <qpainter.h>
 
 #include <kaction.h>
@@ -41,6 +42,8 @@
     setDateFormat ( Qt::ISODate );
     QObject::connect( this, SIGNAL( doubleClicked( int, int, int, const QPoint & ) \
),  m_dataTable, SLOT( scrollTabRight() ) );
+
+/*    viewport()->setMouseTracking( true );*/
 }
 
 DataTableView::~DataTableView()
@@ -108,7 +111,10 @@
 {
     if ( selected )
     {
-        QDataTable::paintCell( p, row, col, cr, selected, cg );
+        QColorGroup hi(cg);
+        hi.setColor( QColorGroup::Highlight, Qt::green );
+        hi.setColor( QColorGroup::HighlightedText, Qt::black );
+        QDataTable::paintCell( p, row, col, cr, selected, hi );
         return ;
     }
 
@@ -189,6 +195,12 @@
     }
 }
 
+QWidget* DataTableView::beginEdit ( int, int, bool )
+{
+    //do nothing
+    return 0L;
+}
+
 void DataTableView::contentsContextMenuEvent( QContextMenuEvent *e )
 {
     KPopupMenu *context = new KPopupMenu( this );
@@ -197,10 +209,10 @@
     context->exec( e->globalPos() );
 }
 
-QWidget* DataTableView::beginEdit ( int, int, bool )
+void DataTableView::contentsMouseMoveEvent( QMouseEvent * e )
 {
-    //do nothing
-    return 0L;
+    QDataTable::contentsMouseMoveEvent( e );
+    slotSelectRow( rowAt( e->pos().y() ) );
 }
 
 #include "datatableview.moc"
--- trunk/extragear/office/datakiosk/src/datatableview.h #411380:411381
@@ -37,11 +37,13 @@
     void handleError( const QSqlError & error );
     virtual void paintCell( QPainter * p, int row, int col, const QRect & cr,
                             bool selected, const QColorGroup &cg );
-    virtual void paintField( QPainter * p, const QSqlField* field, const QRect & cr, \
bool b ); +    virtual void paintField( QPainter * p, const QSqlField* field,
+                             const QRect & cr, bool b );
 
     QWidget* beginEdit( int row, int col, bool replace = FALSE );
 
     virtual void contentsContextMenuEvent( QContextMenuEvent *e );
+    virtual void contentsMouseMoveEvent( QMouseEvent * e );
 
 private:
     DataTable *m_dataTable;
--- trunk/extragear/office/datakiosk/src/project.cpp #411380:411381
@@ -1264,12 +1264,12 @@
     if ( suggest.isEmpty() )
         return uniqueDataTableName();
 
-	bool contains = false;
-	QStringList::ConstIterator it = m_dataTableNames.begin();
-	for ( ; it != m_dataTableNames.end(); ++it )
-		contains = DataTable::sanitize( (*it) ) == 
-				   	DataTable::sanitize( suggest ) ? 
-					true : contains;
+    bool contains = false;
+    QStringList::ConstIterator it = m_dataTableNames.begin();
+    for ( ; it != m_dataTableNames.end(); ++it )
+        contains = DataTable::sanitize( (*it) ) ==
+                    DataTable::sanitize( suggest ) ?
+                    true : contains;
 
     if ( !contains )
         return suggest;
@@ -1492,8 +1492,8 @@
 
     createAction( i18n( "Commit Changes" ), SLOT( slotCommit() ), "commit", "", \
"CTRL+s" );  
-    createAction( i18n( "Insert Record" ), SLOT( slotInsertRecord() ), "insert", "", \
                "CTRL+i" );
-    createAction( i18n( "Delete Record" ), SLOT( slotDeleteRecord() ), "delete", "", \
"CTRL+d" ); +    createAction( i18n( "Insert Record" ), SLOT( slotInsertRecord() ), \
"insert", "insert_row", "CTRL+i" ); +    createAction( i18n( "Delete Record" ), SLOT( \
slotDeleteRecord() ), "delete", "delete_row", "CTRL+d" );  }
 
 KAction *Project::ActionHandler::createAction( const QString &text,


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

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