/*************************************************************************** * Copyright (C) 2005-2006 by Tarek Saidi * * tarek.saidi@arcor.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include "keepassx-gnome.h" #define CSTR(x)(x.toUtf8().data()) Q_EXPORT_PLUGIN2(keepassx_gnome, GnomePlugin) bool GnomePlugin::init(int argc, char** argv){ int t_argc=argc; char** t_argv=argv; return gtk_init_check(&t_argc,&t_argv); } QString GnomePlugin::openExistingFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters){ unsigned int NumFilters=Filters.size(); GtkWidget *FileDlg; QString filename; FileDlg=gtk_file_chooser_dialog_new(CSTR(title),NULL, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(FileDlg),CSTR(dir)); GtkFileFilter** filters=parseFilterStrings(Filters); for(int i=0;idata); FilenameList=FilenameList->next; } g_slist_free(front); } gtk_widget_destroy(FileDlg); return filenames; } QString GnomePlugin::saveFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,bool OverWriteWarn){ unsigned int NumFilters=Filters.size(); GtkWidget *FileDlg; QString filename; FileDlg=gtk_file_chooser_dialog_new(CSTR(title),NULL, GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(FileDlg),CSTR(dir)); gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(FileDlg),OverWriteWarn); GtkFileFilter** filters=parseFilterStrings(Filters); for(int i=0;i