Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

global.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                                                         *
00003  *   global.cpp                                                            *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   Read the file COPYING for details.                                    *
00011  *                                                                         *
00012  *   copyright: (C) 2003 by Jan Mueller                                    *
00013  *   email: janmueller7@hotmail.com                                        *
00014  *                                                                         *
00015  ***************************************************************************/
00016 
00017 #include "global.h"
00018 #include <qpixmap.h>
00019 #include <qimage.h>
00020 #include <qdragobject.h>
00021 #include <qstring.h>
00022 #include <qsqldatabase.h>
00023 #include <kiconloader.h>
00024 #include "dbdata.h"
00025 
00026 QIntDict<bool> locked_recs_dict;
00027 // locked_recs_dict.setAutoDelete(true);
00028 
00029 // void qInitImages_literature();
00030 // extern QMimeSourceFactory* factory;
00031 
00032 QPixmap loadPixmap( const QString &name )
00033 {
00034   return BarIcon(name);
00035 
00036   /* old code, loaded pixmaps from bin */
00037   /*
00038     const QMimeSource *m = QMimeSourceFactory::defaultFactory()->data( name );
00039     //  qInitImages_literature();
00040     // const QMimeSource *m = factory->data(name);
00041     if ( !m )
00042     return QPixmap();
00043     QPixmap pix;
00044     QImageDrag::decode( m, pix );
00045     return pix;
00046   */
00047 }
00048 
00049 bool createConnection(QString conn_name)
00050 {
00051   // create the default database connection
00052   
00053   QSqlDatabase *db = QSqlDatabase::addDatabase( SQL_DRIVER, conn_name);
00054   if ( ! db ) {
00055     qWarning( "Failed to connect to driver" );
00056     return FALSE;
00057   }
00058   db->setDatabaseName( DB_NAME );
00059   db->setUserName( DB_USER );
00060   db->setPassword( DB_PASSWD );
00061   db->setHostName( DB_HOST );
00062   if ( ! db->open() ) {
00063     qWarning( "Failed to open database: " +
00064               db->lastError().driverText() );
00065     qWarning( db->lastError().databaseText() );
00066     return FALSE;
00067   }
00068   return true;
00069 }

Generated on Sat Mar 27 19:20:39 2004 for Literature by doxygen 1.3.6-20040222