Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[r61]: trunk / sqlitebrowser / sqlitebrowser / extendedmainform.cpp Maximize Restore History

Download this file

extendedmainform.cpp    41 lines (30 with data), 1.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//---------------------------------------------------------------
// ExtendedMainForm: This class extends the mainForm class
// to support drag and drop of sql file.
//
// Developer: Arvind Kumar Gupta
// arvind.your@gmail.com
//---------------------------------------------------------------
#include "extendedmainform.h"
#include <QUrl>
ExtendedMainForm::ExtendedMainForm(QWidget* parent, const char* name, Qt::WindowFlags fl) : mainForm( parent, name, fl )
{
setAcceptDrops(true); // Enable the drop feature on this form
}
ExtendedMainForm::~ExtendedMainForm(void)
{
}
void ExtendedMainForm::dragEnterEvent(QDragEnterEvent *event)
{
if( event->mimeData()->hasFormat("text/uri-list") )
event->acceptProposedAction();
}
void ExtendedMainForm::dropEvent(QDropEvent *event)
{
QList<QUrl> urls = event->mimeData()->urls();
if( urls.isEmpty() )
return;
QString fileName = urls.first().toLocalFile();
if( !fileName.isEmpty() && fileName.endsWith("db") )
fileOpen(fileName);
}