Example #1
0
void IPFilterFrame::InitDocument() {
    if (WBGET(WB_IPFILTER_ENABLED)) {
        checkBox_ENABLE->setChecked(true);
    } else
        checkBox_ENABLE->setChecked(false);

    if (!model)
        model = new IPFilterModel(this);

    treeView_RULES->setModel(model);
    treeView_RULES->setContextMenuPolicy(Qt::CustomContextMenu);
    treeView_RULES->setAlternatingRowColors(true);

    slotCheckBoxClick();

    connect(checkBox_ENABLE, SIGNAL(clicked()), this, SLOT(slotCheckBoxClick()));

    connect(pushButton_EXPORT, SIGNAL(clicked()), this, SLOT(slotExport()));
    connect(pushButton_IMPORT, SIGNAL(clicked()), this, SLOT(slotImport()));
    connect(pushButton_ADD, SIGNAL(clicked()), this, SLOT(slotAddRule()));

    connect(pushButton_UP, SIGNAL(clicked()), this, SLOT(slotUpDownClick()));
    connect(pushButton_DOWN, SIGNAL(clicked()), this, SLOT(slotUpDownClick()));

    connect(treeView_RULES, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotTreeViewContextMenu(QPoint)));
}
Example #2
0
void keyServer::preimport()
{
        transferKeyID();
        if (listpop->kLEID->text().isEmpty()) {
                KMessageBox::sorry(this,i18n("You must choose a key."));
                return;
        }
        page->kLEimportid->setText(listpop->kLEID->text());
        dialogServer->close();
        slotImport();
}
XXPortManager::XXPortManager( QWidget *parent )
  : QObject( parent ), mSelectionModel( 0 ),
    mParentWidget( parent ), mImportProgressDialog( 0 )
{
  mImportMapper = new QSignalMapper( this );
  mExportMapper = new QSignalMapper( this );

  connect( mImportMapper, SIGNAL(mapped(QString)),
           this, SLOT(slotImport(QString)) );
  connect( mExportMapper, SIGNAL(mapped(QString)),
           this, SLOT(slotExport(QString)) );
}
Example #4
0
keyServer::keyServer(QWidget *parent, const char *name,bool modal,bool autoClose):KDialogBase( Swallow, i18n("Key Server"), Close, Close, parent, name,modal)
{
	autoCloseWindow=autoClose;
	config=new KSimpleConfig ("kgpgrc");
	page=new keyServerWidget();
	setMainWidget(page);

        syncCombobox();
        page->kLEimportid->setFocus();

        connect(page->Buttonimport,SIGNAL(clicked()),this,SLOT(slotImport()));
        connect(page->Buttonsearch,SIGNAL(clicked()),this,SLOT(slotSearch()));
        connect(page->Buttonexport,SIGNAL(clicked()),this,SLOT(slotPreExport()));
        connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));

        connect(page->cBproxyI,SIGNAL(toggled(bool)),this,SLOT(slotEnableProxyI(bool)));
        connect(page->cBproxyE,SIGNAL(toggled(bool)),this,SLOT(slotEnableProxyE(bool)));

        connect(page->kLEimportid,  SIGNAL( textChanged ( const QString & )), this,  SLOT( slotTextChanged( const QString &)));
	page->cBproxyI->setChecked(KGpgSettings::useProxy());
        page->cBproxyE->setChecked(KGpgSettings::useProxy());
        const char *httpproxy = getenv("http_proxy");
        if (httpproxy) {
                page->cBproxyI->setEnabled(true);
                page->cBproxyE->setEnabled(true);
                page->kLEproxyI->setText(httpproxy);
                page->kLEproxyE->setText(httpproxy);
        }


        KProcIO *encid=new KProcIO(QTextCodec::codecForLocale());
        *encid << "gpg"<<"--no-secmem-warning"<<"--no-tty"<<"--with-colon"<<"--list-keys";
        QObject::connect(encid, SIGNAL(readReady(KProcIO *)),this, SLOT(slotprocread(KProcIO *)));
        encid->start(KProcess::NotifyOnExit,true);
        page->Buttonimport->setEnabled( !page->kLEimportid->text().isEmpty());
        page->Buttonsearch->setEnabled( !page->kLEimportid->text().isEmpty());
setMinimumSize(sizeHint());
}
Example #5
0
ImportDialog::ImportDialog(QWidget *parent)
		: QDialog(parent) //, 0, FALSE, Qt::WDestructiveClose)
{
  setWindowTitle(tr("Convert Data File..."));

  all = new QGridLayout(this);

  QGroupBox *Group2 = new QGroupBox(tr("File specification"),this);
  
  QGridLayout *file = new QGridLayout();
  file->addWidget(new QLabel(tr("Input File:")),0, 0);
  ImportEdit = new QLineEdit();
  file->addWidget(ImportEdit, 0, 1);
  QPushButton *BrowseButt = new QPushButton(tr("Browse"));
  file->addWidget(BrowseButt, 0, 2);
  connect(BrowseButt, SIGNAL(clicked()), SLOT(slotBrowse()));
  file->addWidget(new QLabel(tr("Output File:")), 1, 0);
  OutputEdit = new QLineEdit();
  file->addWidget(OutputEdit, 1, 1);
  OutputLabel = new QLabel(tr("Output Data:"));
  OutputLabel->setEnabled(false);
  file->addWidget(OutputLabel, 2, 0);
  OutputData = new QLineEdit();
  OutputData->setEnabled(false);
  file->addWidget(OutputData, 2, 1);
  OutType = new QComboBox();
  OutType->addItem(tr("Simgui dataset"));
  OutType->addItem(tr("Touchstone"));
  OutType->addItem(tr("CSV"));
  OutType->addItem(tr("Simgui library"));
  OutType->addItem(tr("Simgui netlist"));
  OutType->addItem(tr("Matlab"));
  connect(OutType, SIGNAL(activated(int)), SLOT(slotType(int)));
  file->addWidget(OutType, 2, 2);
  
  Group2->setLayout(file);
  all->addWidget(Group2, 0,0,1,1);
  
  QGroupBox *Group1 = new QGroupBox(tr("Messages"));
  
  QVBoxLayout *vMess = new QVBoxLayout();
  MsgText = new QTextEdit();
  vMess->addWidget(MsgText);
  MsgText->setTextFormat(Qt::PlainText);
  MsgText->setReadOnly(true);
  MsgText->setWordWrapMode(QTextOption::NoWrap);
  MsgText->setMinimumSize(250, 60);
  Group1->setLayout(vMess);
  all->addWidget(Group1, 1,0,1,1);

  QHBoxLayout *Butts = new QHBoxLayout();
  
  Butts->addStretch(5);
 
  ImportButt = new QPushButton(tr("Convert"));
  connect(ImportButt, SIGNAL(clicked()), SLOT(slotImport()));
  AbortButt = new QPushButton(tr("Abort"));
  AbortButt->setDisabled(true);
  connect(AbortButt, SIGNAL(clicked()), SLOT(slotAbort()));
  CancelButt = new QPushButton(tr("Close"));
  connect(CancelButt, SIGNAL(clicked()), SLOT(reject()));
  Butts->addWidget(ImportButt);
  Butts->addWidget(AbortButt);
  Butts->addWidget(CancelButt);
  
  all->addLayout(Butts,2,0,1,1);
}
Example #6
0
void XXPortManager::importVCardFromData(const QString &vCard)
{
    importData = vCard;
    slotImport("vcard", "<empty>");
    importData = "";
}
Example #7
0
void XXPortManager::importVCard(const KURL &url)
{
    importURL = url;
    slotImport("vcard", "<empty>");
    importURL = KURL();
}
Example #8
0
// decoupled from resetActions in toplevel.cpp
// as resetActions simply uses the action groups
// specified in the ui.rc file
void KEBApp::createActions() {

    m_actionsImpl = new ActionsImpl(this, GlobalBookmarkManager::self()->model());

    connect(m_actionsImpl->testLinkHolder(), SIGNAL(setCancelEnabled(bool)),
            this, SLOT(setCancelTestsEnabled(bool)));
    connect(m_actionsImpl->favIconHolder(), SIGNAL(setCancelEnabled(bool)),
            this, SLOT(setCancelFavIconUpdatesEnabled(bool)));

    // save and quit should probably not be in the toplevel???
    (void) KStandardAction::quit(
        this, SLOT( close() ), actionCollection());
    KStandardAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection());
    (void) KStandardAction::configureToolbars(
        this, SLOT( slotConfigureToolbars() ), actionCollection());

    if (m_browser) {
        (void) KStandardAction::open(
            m_actionsImpl, SLOT( slotLoad() ), actionCollection());
        (void) KStandardAction::saveAs(
            m_actionsImpl, SLOT( slotSaveAs() ), actionCollection());
    }

    (void) KStandardAction::cut(m_actionsImpl, SLOT( slotCut() ), actionCollection());
    (void) KStandardAction::copy(m_actionsImpl, SLOT( slotCopy() ), actionCollection());
    (void) KStandardAction::paste(m_actionsImpl, SLOT( slotPaste() ), actionCollection());

    // actions
    KAction* m_actionsImplDelete = actionCollection()->addAction("delete");
    m_actionsImplDelete->setIcon(KIcon("edit-delete"));
    m_actionsImplDelete->setText(i18n("&Delete"));
    m_actionsImplDelete->setShortcut(Qt::Key_Delete);
    connect(m_actionsImplDelete, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotDelete() ));

    KAction* m_actionsImplRename = actionCollection()->addAction("rename");
    m_actionsImplRename->setIcon(KIcon("edit-rename"));
    m_actionsImplRename->setText(i18n("Rename"));
    m_actionsImplRename->setShortcut(Qt::Key_F2);
    connect(m_actionsImplRename, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotRename() ));

    KAction* m_actionsImplChangeURL = actionCollection()->addAction("changeurl");
    m_actionsImplChangeURL->setIcon(KIcon("edit-rename"));
    m_actionsImplChangeURL->setText(i18n("C&hange Location"));
    m_actionsImplChangeURL->setShortcut(Qt::Key_F3);
    connect(m_actionsImplChangeURL, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotChangeURL() ));

    KAction* m_actionsImplChangeComment = actionCollection()->addAction("changecomment");
    m_actionsImplChangeComment->setIcon(KIcon("edit-rename"));
    m_actionsImplChangeComment->setText(i18n("C&hange Comment"));
    m_actionsImplChangeComment->setShortcut(Qt::Key_F4);
    connect(m_actionsImplChangeComment, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotChangeComment() ));

    KAction* m_actionsImplChangeIcon = actionCollection()->addAction("changeicon");
    m_actionsImplChangeIcon->setIcon(KIcon("preferences-desktop-icons"));
    m_actionsImplChangeIcon->setText(i18n("Chan&ge Icon..."));
    connect(m_actionsImplChangeIcon, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotChangeIcon() ));

    KAction* m_actionsImplUpdateFavIcon = actionCollection()->addAction("updatefavicon");
    m_actionsImplUpdateFavIcon->setText(i18n("Update Favicon"));
    connect(m_actionsImplUpdateFavIcon, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotUpdateFavIcon() ));

    KAction* m_actionsImplRecursiveSort = actionCollection()->addAction("recursivesort");
    m_actionsImplRecursiveSort->setText(i18n("Recursive Sort"));
    connect(m_actionsImplRecursiveSort, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotRecursiveSort() ));

    KAction* m_actionsImplNewFolder = actionCollection()->addAction("newfolder");
    m_actionsImplNewFolder->setIcon(KIcon("folder-new"));
    m_actionsImplNewFolder->setText(i18n("&New Folder..."));
    m_actionsImplNewFolder->setShortcut(Qt::CTRL+Qt::Key_N);
    connect(m_actionsImplNewFolder, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotNewFolder() ));

    KAction* m_actionsImplNewBookmark = actionCollection()->addAction("newbookmark");
    m_actionsImplNewBookmark->setIcon(KIcon("bookmark-new"));
    m_actionsImplNewBookmark->setText(i18n("&New Bookmark"));
    connect(m_actionsImplNewBookmark, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotNewBookmark() ));

    KAction* m_actionsImplInsertSeparator = actionCollection()->addAction("insertseparator");
    m_actionsImplInsertSeparator->setText(i18n("&Insert Separator"));
    m_actionsImplInsertSeparator->setShortcut(Qt::CTRL+Qt::Key_I);
    connect(m_actionsImplInsertSeparator, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotInsertSeparator() ));

    KAction* m_actionsImplSort = actionCollection()->addAction("sort");
    m_actionsImplSort->setText(i18n("&Sort Alphabetically"));
    connect(m_actionsImplSort, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotSort() ));

    KAction* m_actionsImplSetAsToolbar = actionCollection()->addAction("setastoolbar");
    m_actionsImplSetAsToolbar->setIcon(KIcon("bookmark-toolbar"));
    m_actionsImplSetAsToolbar->setText(i18n("Set as T&oolbar Folder"));
    connect(m_actionsImplSetAsToolbar, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotSetAsToolbar() ));

    KAction* m_actionsImplExpandAll = actionCollection()->addAction("expandall");
    m_actionsImplExpandAll->setText(i18n("&Expand All Folders"));
    connect(m_actionsImplExpandAll, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExpandAll() ));

    KAction* m_actionsImplCollapseAll = actionCollection()->addAction("collapseall");
    m_actionsImplCollapseAll->setText(i18n("Collapse &All Folders"));
    connect(m_actionsImplCollapseAll, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotCollapseAll() ));

    KAction* m_actionsImplOpenLink = actionCollection()->addAction("openlink");
    m_actionsImplOpenLink->setIcon(KIcon("document-open"));
    m_actionsImplOpenLink->setText(i18n("&Open in Konqueror"));
    connect(m_actionsImplOpenLink, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotOpenLink() ));

    KAction* m_actionsImplTestSelection = actionCollection()->addAction("testlink");
    m_actionsImplTestSelection->setIcon(KIcon("bookmarks"));
    m_actionsImplTestSelection->setText(i18n("Check &Status"));
    connect(m_actionsImplTestSelection, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotTestSelection() ));

    KAction* m_actionsImplTestAll = actionCollection()->addAction("testall");
    m_actionsImplTestAll->setText(i18n("Check Status: &All"));
    connect(m_actionsImplTestAll, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotTestAll() ));

    KAction* m_actionsImplUpdateAllFavIcons = actionCollection()->addAction("updateallfavicons");
    m_actionsImplUpdateAllFavIcons->setText(i18n("Update All &Favicons"));
    connect(m_actionsImplUpdateAllFavIcons, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotUpdateAllFavIcons() ));

    KAction* m_actionsImplCancelAllTests = actionCollection()->addAction("canceltests");
    m_actionsImplCancelAllTests->setText(i18n("Cancel &Checks"));
    connect(m_actionsImplCancelAllTests, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotCancelAllTests() ));

    KAction* m_actionsImplCancelFavIconUpdates = actionCollection()->addAction("cancelfaviconupdates");
    m_actionsImplCancelFavIconUpdates->setText(i18n("Cancel &Favicon Updates"));
    connect(m_actionsImplCancelFavIconUpdates, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotCancelFavIconUpdates() ));

    KAction* m_actionsImplImportNS = actionCollection()->addAction("importNS");
    m_actionsImplImportNS->setObjectName( QLatin1String("NS" ));
    m_actionsImplImportNS->setIcon(KIcon("netscape"));
    m_actionsImplImportNS->setText(i18n("Import &Netscape Bookmarks..."));
    connect(m_actionsImplImportNS, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplImportOpera = actionCollection()->addAction("importOpera");
    m_actionsImplImportOpera->setObjectName( QLatin1String("Opera" ));
    m_actionsImplImportOpera->setIcon(KIcon("opera"));
    m_actionsImplImportOpera->setText(i18n("Import &Opera Bookmarks..."));
    connect(m_actionsImplImportOpera, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));
/*
    KAction* m_actionsImplImportCrashes = actionCollection()->addAction("importCrashes");
    m_actionsImplImportCrashes->setObjectName( QLatin1String("Crashes" ));
    m_actionsImplImportCrashes->setText(i18n("Import All &Crash Sessions as Bookmarks..."));
    connect(m_actionsImplImportCrashes, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));
*/
    KAction* m_actionsImplImportGaleon = actionCollection()->addAction("importGaleon");
    m_actionsImplImportGaleon->setObjectName( QLatin1String("Galeon" ));
    m_actionsImplImportGaleon->setText(i18n("Import &Galeon Bookmarks..."));
    connect(m_actionsImplImportGaleon, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplImportKDE2 = actionCollection()->addAction("importKDE2");
    m_actionsImplImportKDE2->setObjectName( QLatin1String("KDE2" ));
    m_actionsImplImportKDE2->setIcon(KIcon("kde"));
    m_actionsImplImportKDE2->setText(i18n("Import &KDE 2 or KDE 3 Bookmarks..."));

    connect(m_actionsImplImportKDE2, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplImportIE = actionCollection()->addAction("importIE");
    m_actionsImplImportIE->setObjectName( QLatin1String("IE" ));
    m_actionsImplImportIE->setText(i18n("Import &Internet Explorer Bookmarks..."));
    connect(m_actionsImplImportIE, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplImportMoz = actionCollection()->addAction("importMoz");
    m_actionsImplImportMoz->setObjectName( QLatin1String("Moz" ));
    m_actionsImplImportMoz->setIcon(KIcon("mozilla"));
    m_actionsImplImportMoz->setText(i18n("Import &Mozilla Bookmarks..."));
    connect(m_actionsImplImportMoz, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplExportNS = actionCollection()->addAction("exportNS");
    m_actionsImplExportNS->setIcon(KIcon("netscape"));
    m_actionsImplExportNS->setText(i18n("Export &Netscape Bookmarks"));
    connect(m_actionsImplExportNS, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportNS() ));

    KAction* m_actionsImplExportOpera = actionCollection()->addAction("exportOpera");
    m_actionsImplExportOpera->setIcon(KIcon("opera"));
    m_actionsImplExportOpera->setText(i18n("Export &Opera Bookmarks..."));
    connect(m_actionsImplExportOpera, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportOpera() ));

    KAction* m_actionsImplExportHTML = actionCollection()->addAction("exportHTML");
    m_actionsImplExportHTML->setIcon(KIcon("text-html"));
    m_actionsImplExportHTML->setText(i18n("Export &HTML Bookmarks..."));
    connect(m_actionsImplExportHTML, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportHTML() ));

    KAction* m_actionsImplExportIE = actionCollection()->addAction("exportIE");
    m_actionsImplExportIE->setText(i18n("Export &Internet Explorer Bookmarks..."));
    connect(m_actionsImplExportIE, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportIE() ));

    KAction* m_actionsImplExportMoz = actionCollection()->addAction("exportMoz");
    m_actionsImplExportMoz->setIcon(KIcon("mozilla"));
    m_actionsImplExportMoz->setText(i18n("Export &Mozilla Bookmarks..."));
    connect(m_actionsImplExportMoz, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportMoz() ));
}
void ImageImporter::initGUI() {
    m_ImageImporterLayout = new QVBoxLayout( this, 11, 6, "ImageImporterLayout");

    m_grpSource = new QGroupBox( this, "grpSource" );
    m_grpSource->setTitle( i18n( "Source" ) );
    m_grpSource->setColumnLayout(0, Qt::Vertical );
    m_grpSource->layout()->setSpacing( 6 );
    m_grpSource->layout()->setMargin( 11 );
    m_grpSourceLayout = new QGridLayout( m_grpSource->layout() );
    m_grpSourceLayout->setAlignment( Qt::AlignTop );


    m_cmbSourceDevice = new QComboBox( false, m_grpSource, "cmbSourceDevice" );
    m_grpSourceLayout->addWidget( new QLabel(m_cmbSourceDevice, i18n( "Device:" ), m_grpSource, "lblDevice" ), 0, 0 );
    connect(m_cmbSourceDevice, SIGNAL(highlighted(const QString& )), SLOT(slotUpdateMountStatus()));
    //     m_cmbSourceDevice->setEditable( true );
    m_grpSourceLayout->addWidget( m_cmbSourceDevice, 0, 1 );
    QWhatsThis::add(m_cmbSourceDevice, i18n( "Here you can select a device which you can <i>mount</i> and then import your images from.<br>"
                                             "Mountpoints are only listed, if they are mountable by this user!" ));

    m_btnMountDevice = new QPushButton( m_grpSource, "btnMountDevice" );
    m_btnMountDevice->setText( i18n( "Mount" ) );
    //m_btnMountDevice->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)0, 0, 0, m_btnMountDevice->sizePolicy().hasHeightForWidth() ) );
    m_btnMountDevice->setToggleButton( TRUE );
    connect(m_btnMountDevice, SIGNAL(clicked()), SLOT(slotMountDevice()));
    m_grpSourceLayout->addWidget( m_btnMountDevice, 0, 2 );
    QWhatsThis::add(m_btnMountDevice, i18n( "Mounts/Unmounts the currently selected mountpoint." ));

    m_cmbSourceFolder = new QComboBox( m_grpSource, "txtSourceFolder" );
    m_cmbSourceFolder->setEditable(true);
    m_cmbSourceFolder->setDuplicatesEnabled( false );

    m_grpSourceLayout->addWidget( new QLabel(m_cmbSourceFolder, i18n( "Folder:" ), m_grpSource, "lblFolder" ), 1, 0 );
    m_grpSourceLayout->addWidget( m_cmbSourceFolder, 1, 1 );
    QWhatsThis::add(m_cmbSourceFolder, i18n( "Enter the name of the folder, from where you want to import your Images." ));

    m_btnSourceFolder = new QPushButton( m_grpSource, "btnSourceFolder" );
    m_btnSourceFolder->setText( i18n( "..." ) );
    connect(m_btnSourceFolder, SIGNAL(clicked()), SLOT(slotBtnSourceFolder()));
    m_grpSourceLayout->addWidget( m_btnSourceFolder, 1, 2 );
    QWhatsThis::add(m_btnSourceFolder, i18n( "Select the import folder." ));

    QFrame* line = new QFrame( m_grpSource, "lineSource1" );
    line->setFrameShape( QFrame::HLine );
    line->setFrameShadow( QFrame::Sunken );
    line->setFrameShape( QFrame::HLine );
    m_grpSourceLayout->addMultiCellWidget( line, 2, 2, 0, 2 );

    m_txtSourceFilename = new QLineEdit( m_grpSource, "txtSourceFilename" );
    m_grpSourceLayout->addWidget( new QLabel(m_txtSourceFilename, i18n("Filename:"), m_grpSource, "lblSourceFilename" ), 3, 0 );
    m_grpSourceLayout->addMultiCellWidget( m_txtSourceFilename, 3, 3, 1, 2 );
    QWhatsThis::add(m_txtSourceFilename, i18n( "Contains a Regular Expression to match the files you want to import."
                                               "You can use captures here '()'. These will replace $0 and $1, $2, etc... "
                                               "in the output names." ));


    m_chkIgnoreCase = new QCheckBox("Ignore case", m_grpSource);
    m_grpSourceLayout->addWidget( m_chkIgnoreCase, 4, 1 );
    QWhatsThis::add( m_chkIgnoreCase, i18n( "Toggles, whether the filename-regexp should be matched case sensitive or not" ) );

    line = new QFrame( m_grpSource, "lineSource2" );
    line->setFrameShape( QFrame::HLine );
    line->setFrameShadow( QFrame::Sunken );
    line->setFrameShape( QFrame::HLine );
    m_grpSourceLayout->addMultiCellWidget( line, 2, 2, 0, 2 );
    m_grpSourceLayout->addMultiCellWidget( line, 5, 5, 0, 2 );

    m_chkSrcIncludeSubfolders = new QCheckBox( m_grpSource, "chkSrcIncludeSubfolders" );
    m_chkSrcIncludeSubfolders->setText( i18n( "Include subfolders" ) );
    m_chkSrcIncludeSubfolders->setChecked( true );
    m_grpSourceLayout->addMultiCellWidget( m_chkSrcIncludeSubfolders, 6, 6, 1, 2 );
    QWhatsThis::add(m_chkSrcIncludeSubfolders, i18n( "If you also want to import files placed in subfolders of the given basefolder, check this." ));

    m_chkSrcRemoveFilesFromSrc = new QCheckBox( m_grpSource, "chkSrcRemoveFilesFromSource" );
    m_chkSrcRemoveFilesFromSrc->setText( i18n( "Remove successfully transfered files from given source (i.e. move the files)" ) );
    m_chkSrcRemoveFilesFromSrc->setChecked( true );
    m_grpSourceLayout->addMultiCellWidget( m_chkSrcRemoveFilesFromSrc, 7, 7, 1, 2 );
    QWhatsThis::add(m_chkSrcRemoveFilesFromSrc, i18n( "If you want the imported images to be removed from the source, check this." ));

    m_ImageImporterLayout->addWidget( m_grpSource );

    m_ImageImporterLayout->addItem(new QSpacerItem( 40, 20, QSizePolicy::Fixed, QSizePolicy::Fixed));


    m_groupArchive = new QGroupBox( this, "groupArchive" );
    m_groupArchive->setTitle( i18n( "Archive" ) );
    m_groupArchive->setCheckable( true );
    m_groupArchive->setColumnLayout(0, Qt::Vertical );
    m_groupArchive->layout()->setSpacing( 6 );
    m_groupArchive->layout()->setMargin( 11 );
    m_groupArchiveLayout = new QGridLayout( m_groupArchive->layout() );
    m_groupArchiveLayout->setAlignment( Qt::AlignTop );
    QWhatsThis::add( m_groupArchive, i18n( "If you want to create a copy of your original images (for security reasons), select this option." ) );

    m_txtArchiveBaseFolder = new QLineEdit( m_groupArchive, "txtArchiveBaseFolder" );
    connect(m_txtArchiveBaseFolder, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateArchiveExample()));
    m_groupArchiveLayout->addWidget( m_txtArchiveBaseFolder, 0, 1 );
    m_groupArchiveLayout->addWidget( new QLabel(m_txtArchiveBaseFolder, i18n( "Base Folder" ), m_groupArchive, "lblArchiveBaseFolder" ), 0, 0 );
    QPushButton* btn = new QPushButton(i18n( "..." ), m_groupArchive, "btnArhiveBaseFolder" );
    m_groupArchiveLayout->addWidget( btn, 0, 2 );
    connect(btn, SIGNAL(clicked()), this, SLOT(slotBtnArchiveBaseFolder()));
    QWhatsThis::add( m_txtArchiveBaseFolder, i18n( "This is the base folder, all your archived images will be copied to." ) );

    m_txtArchiveSubfolders = new QLineEdit( m_groupArchive, "txtArchiveSubfolders" );
    connect(m_txtArchiveSubfolders, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateArchiveExample()));
    m_groupArchiveLayout->addWidget( m_txtArchiveSubfolders, 1, 1 );
    m_groupArchiveLayout->addWidget( new QLabel(m_txtArchiveSubfolders, i18n( "Subfolders" ), m_groupArchive, "blbArchiveSubfolders" ), 1, 0 );
    QWhatsThis::add(m_txtArchiveSubfolders, helpText("For every image a subfolder is created in the base folder."));

    m_txtArchiveFilename = new QLineEdit( m_groupArchive, "txtArchiveFilename" );
    connect(m_txtArchiveFilename, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateArchiveExample()));
    m_groupArchiveLayout->addWidget( m_txtArchiveFilename, 2, 1 );
    m_groupArchiveLayout->addWidget( new QLabel(m_txtArchiveFilename, i18n( "File RegExp" ), m_groupArchive, "lblArchiveFilename" ), 2, 0 );
    QWhatsThis::add(m_txtArchiveFilename, helpText("This is the name of archived image in the subfolder."));

    m_chkArchiveLowercase = new QCheckBox( m_groupArchive, "chkArchiveLowercase" );
    m_chkArchiveLowercase->setText( i18n( "lowercase filenames" ) );
    m_chkArchiveLowercase->setChecked( true );
    m_groupArchiveLayout->addMultiCellWidget( m_chkArchiveLowercase, 3, 3, 1, 2 );
    QWhatsThis::add(m_chkArchiveLowercase, i18n( "Should your images be translated to lowercase finally?" ));


    line = new QFrame( m_groupArchive, "lineArchive" );
    line->setFrameShape( QFrame::HLine );
    line->setFrameShadow( QFrame::Sunken );
    line->setFrameShape( QFrame::HLine );
    m_groupArchiveLayout->addMultiCellWidget( line, 4, 4, 0, 2 );

    m_groupArchiveLayout->addWidget( new QLabel(i18n( "Example" ), m_groupArchive, "lblArchiveExample" ), 5, 0 );

    m_lblArchiveExampleString = new KSqueezedTextLabel( m_groupArchive, "kSqueezedTextLabel1" );
    m_groupArchiveLayout->addMultiCellWidget( m_lblArchiveExampleString, 5, 5, 1, 2 );

    m_ImageImporterLayout->addWidget( m_groupArchive );

    m_groupDest = new QGroupBox( this, "groupDest" );
    m_groupDest->setTitle( i18n( "Destination" ) );
    m_groupDest->setCheckable( FALSE );
    m_groupDest->setColumnLayout(0, Qt::Vertical );
    m_groupDest->layout()->setSpacing( 6 );
    m_groupDest->layout()->setMargin( 11 );
    m_groupDestLayout = new QGridLayout( m_groupDest->layout() );
    m_groupDestLayout->setAlignment( Qt::AlignTop );

    m_cmbDestBasefolder = new QComboBox( m_groupDest, "txtDestBasefolder" );
//     m_cmbDestBasefolder->setEditable( true );
    m_cmbDestBasefolder->setDuplicatesEnabled( false );
    connect(m_cmbDestBasefolder, SIGNAL(highlighted(int)), SLOT(slotUpdateDestExample()));
    m_groupDestLayout->addWidget( m_cmbDestBasefolder, 0, 1 );
    m_groupDestLayout->addWidget( new QLabel(m_cmbDestBasefolder, i18n( "Base Folder" ), m_groupDest, "lblDestBaseFolder" ), 0, 0 );
    btn = new QPushButton(i18n( "..." ), m_groupDest, "btnDestBaseFolder" );
    m_groupDestLayout->addWidget( btn, 0, 2 );
    //this is a temporary hack: it is intended, that someday the user can select an arbitrary folder to copy the images to,
    // which finally is added to the album. But currently the user only can select from folders here, which are already contained in
    // the album.
    btn->hide();
    connect(btn, SIGNAL(clicked()), SLOT(slotBtnDestBaseFolder()));


    m_txtDestSubfolders = new QLineEdit( m_groupDest, "txtDestSubfolders" );
    connect(m_txtDestSubfolders, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateDestExample()));
    m_groupDestLayout->addWidget( m_txtDestSubfolders, 1, 1 );
    m_groupDestLayout->addWidget( new QLabel(m_txtDestSubfolders, i18n( "Subfolders" ), m_groupDest, "lblDestSubfolders" ), 1, 0 );
    QWhatsThis::add(m_txtDestSubfolders, helpText("Set the name of the subfolders of your images."));

    m_txtDestFilename = new QLineEdit( m_groupDest, "txtDestFilename" );
    connect(m_txtDestFilename, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateDestExample()));
    m_groupDestLayout->addWidget( m_txtDestFilename, 2, 1 );
    m_groupDestLayout->addWidget( new QLabel(m_txtDestFilename, i18n( "Filename" ), m_groupDest, "lblDestFilename" ), 2, 0 );
    QWhatsThis::add(m_txtDestFilename, helpText("Set the name of your images."));

    m_chkDestLowercase = new QCheckBox( m_groupDest, "chkDestLowercase" );
    m_chkDestLowercase->setText( i18n( "lowercase filenames" ) );
    m_chkDestLowercase->setChecked( true );
    m_groupDestLayout->addMultiCellWidget( m_chkDestLowercase, 3, 3, 1, 2 );
    QWhatsThis::add(m_chkDestLowercase, i18n( "Should your images be translated to lowercase finally?" ));

    line = new QFrame( m_groupDest, "lineDest" );
    line->setFrameShape( QFrame::HLine );
    line->setFrameShadow( QFrame::Sunken );
    line->setFrameShape( QFrame::HLine );
    m_groupDestLayout->addMultiCellWidget( line, 4, 4, 0, 2 );

    m_groupDestLayout->addWidget( new QLabel(i18n( "Example" ), m_groupDest, "lblDestExample" ), 5, 0 );

    m_lblDestExampleString = new KSqueezedTextLabel( m_groupDest, "lblDestExampleString" );
    m_groupDestLayout->addMultiCellWidget( m_lblDestExampleString, 5, 5, 1, 2 );

    m_ImageImporterLayout->addWidget( m_groupDest );



    QHBoxLayout* btnBottom = new QHBoxLayout( 0, 0, 6, "btnBottom");
    btnBottom->addItem(new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ));

    btn = new QPushButton(i18n( "Import" ), this, "import" );
    btnBottom->addWidget( btn );
    connect(btn, SIGNAL(clicked()), SLOT(slotImport()));

    btn = new QPushButton(i18n( "Quit" ), this, "quit" );
    btnBottom->addWidget( btn );
    connect(btn, SIGNAL(clicked()), SLOT(slotQuit()));

    btn = new QPushButton(i18n( "Cancel" ), this, "cancel" );
    btnBottom->addWidget( btn );
    connect(btn, SIGNAL(clicked()), SLOT(reject()));


    m_ImageImporterLayout->addLayout( btnBottom );

    resize( QSize(551, 519).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );
}
Example #10
0
ImportScreen::ImportScreen(const CompanyDefn& company)
    : QMainWindow(0, "ImportScreen", WType_TopLevel | WDestructiveClose)
{
    _import = new DataImport(company, this);
    connect(_import, SIGNAL(message(int,QString,QString)),
	    SLOT(slotMessage(int,QString,QString)));

    QFrame* frame = new QFrame(this);
    QFrame* file = new QFrame(frame);

    QLabel* fileLabel = new QLabel(tr("Import File:"), file);
    _filePath = new LineEdit(file);
    _filePath->addPopup(Key_F9, tr("browse"));
    fileLabel->setBuddy(_filePath);
    connect(_filePath, SIGNAL(doPopup(QKeySequence)), SLOT(slotOpenFile()));

    QPushButton* browse = new QPushButton("...", file);
    browse->setFocusPolicy(ClickFocus);
    connect(browse, SIGNAL(clicked()), SLOT(slotOpenFile()));

    QGridLayout* fileGrid = new QGridLayout(file);
    fileGrid->setMargin(6);
    fileGrid->setSpacing(6);
    fileGrid->setColStretch(1, 1);
    fileGrid->addWidget(fileLabel, 0, 0);
    fileGrid->addWidget(_filePath, 0, 1);
    fileGrid->addWidget(browse, 0, 2);

    // TODO: add data types

    _log = new ListView(frame);
    _log->addNumberColumn(tr("Count"), 8);
    _log->addTextColumn(tr("Severity"), 12);
    _log->addTextColumn(tr("Data Type"), 16);
    _log->addTextColumn(tr("Data Name"), 20);
    _log->addTextColumn(tr("Message"), 30);
    _log->setAllColumnsShowFocus(true);
    _log->setShowSortIndicator(true);

    QFrame* buttons = new QFrame(frame);
    QPushButton* import = new QPushButton(tr("&Import"), buttons);
    QPushButton* close = new QPushButton(tr("&Close"), buttons);

    connect(import, SIGNAL(clicked()), SLOT(slotImport()));
    connect(close, SIGNAL(clicked()), SLOT(close()));

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(6);
    buttonGrid->setMargin(6);
    buttonGrid->setColStretch(0, 1);
    buttonGrid->addWidget(import, 0, 1);
    buttonGrid->addWidget(close, 0, 2);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(6);
    grid->setRowStretch(1, 1);
    grid->addWidget(file, 0, 0);
    grid->addWidget(_log, 1, 0);
    grid->addWidget(buttons, 2, 0);

    _filePath->setFocus();

    setCentralWidget(frame);
    setCaption(tr("Data Import: " + company.name()));
}
Example #11
0
OpenBalances::OpenBalances(MainWindow* main)
    : QuasarWindow(main, "OpenBalances")
{
    _helpSource = "open_balances.html";

    QFrame* frame = new QFrame(this);
    QFrame* top = new QFrame(frame);

    QLabel* storeLabel = new QLabel(tr("Store:"), top);
    _store = new LookupEdit(new StoreLookup(main, this), top);
    _store->setLength(30);
    storeLabel->setBuddy(_store);
    connect(_store, SIGNAL(validData()), SLOT(slotStoreChanged()));

    QLabel* stationLabel = new QLabel(tr("Station:"), top);
    _station = new LookupEdit(new StationLookup(main, this), top);
    _station->setLength(30);
    stationLabel->setBuddy(_station);

    QLabel* employeeLabel = new QLabel(tr("Employee:"), top);
    _employee = new LookupEdit(new EmployeeLookup(main, this), top);
    _employee->setLength(30);
    employeeLabel->setBuddy(_employee);

    QGridLayout* topGrid = new QGridLayout(top);
    topGrid->setSpacing(6);
    topGrid->setMargin(3);
    topGrid->setColStretch(2, 1);
    topGrid->addWidget(storeLabel, 0, 0);
    topGrid->addWidget(_store, 0, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(stationLabel, 1, 0);
    topGrid->addWidget(_station, 1, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(employeeLabel, 2, 0);
    topGrid->addWidget(_employee, 2, 1, AlignLeft | AlignVCenter);

    QTabWidget* tabs = new QTabWidget(frame);
    QFrame* customers = new QFrame(tabs);
    QFrame* vendors = new QFrame(tabs);
    QFrame* items = new QFrame(tabs);
    QFrame* accounts = new QFrame(tabs);
    tabs->addTab(customers, tr("Customers"));
    tabs->addTab(vendors, tr("Vendors"));
    tabs->addTab(items, tr("Items"));
    tabs->addTab(accounts, tr("Accounts"));

    _customers = new Table(customers);
    _customers->setVScrollBarMode(QScrollView::AlwaysOn);
    _customers->setDisplayRows(10);
    _customers->setLeftMargin(fontMetrics().width("99999"));
    connect(_customers, SIGNAL(cellChanged(int,int,Variant)),
	    SLOT(customerCellChanged(int,int,Variant)));
    connect(_customers, SIGNAL(focusNext(bool&,int&,int&,int)),
	    SLOT(customerFocusNext(bool&,int&,int&,int)));

    CustomerLookup* custLookup = new CustomerLookup(_main, this);

    new LookupColumn(_customers, tr("Customer"), 30, custLookup);
    new DateColumn(_customers, tr("Date"));
    new MoneyColumn(_customers, tr("Amount"), 10);

    new LookupEditor(_customers, 0, new LookupEdit(custLookup, _customers));
    new LineEditor(_customers, 1, new DateEdit(_customers));
    new NumberEditor(_customers, 2, new MoneyEdit(_customers));

    QGridLayout* customerGrid = new QGridLayout(customers);
    customerGrid->setSpacing(6);
    customerGrid->setMargin(3);
    customerGrid->setColStretch(0, 1);
    customerGrid->addWidget(_customers, 0, 0);

    _vendors = new Table(vendors);
    _vendors->setVScrollBarMode(QScrollView::AlwaysOn);
    _vendors->setDisplayRows(10);
    _vendors->setLeftMargin(fontMetrics().width("99999"));
    connect(_vendors, SIGNAL(cellChanged(int,int,Variant)),
	    SLOT(vendorCellChanged(int,int,Variant)));
    connect(_vendors, SIGNAL(focusNext(bool&,int&,int&,int)),
	    SLOT(vendorFocusNext(bool&,int&,int&,int)));

    VendorLookup* vendLookup = new VendorLookup(_main, this);

    new LookupColumn(_vendors, tr("Vendor"), 30, vendLookup);
    new DateColumn(_vendors, tr("Date"));
    new MoneyColumn(_vendors, tr("Amount"), 10);

    new LookupEditor(_vendors, 0, new LookupEdit(vendLookup, _vendors));
    new LineEditor(_vendors, 1, new DateEdit(_vendors));
    new NumberEditor(_vendors, 2, new MoneyEdit(_vendors));

    QGridLayout* vendorGrid = new QGridLayout(vendors);
    vendorGrid->setSpacing(6);
    vendorGrid->setMargin(3);
    vendorGrid->setColStretch(0, 1);
    vendorGrid->addWidget(_vendors, 0, 0);

    _items = new Table(items);
    _items->setVScrollBarMode(QScrollView::AlwaysOn);
    _items->setDisplayRows(10);
    _items->setLeftMargin(fontMetrics().width("99999"));
    connect(_items, SIGNAL(cellMoved(int,int)), SLOT(itemCellMoved(int,int)));
    connect(_items, SIGNAL(cellChanged(int,int,Variant)),
	    SLOT(itemCellChanged(int,int,Variant)));
    connect(_items, SIGNAL(focusNext(bool&,int&,int&,int)),
	    SLOT(itemFocusNext(bool&,int&,int&,int)));

    _itemLookup = new ItemLookup(_main, this);
    _itemLookup->inventoriedOnly = true;

    new LookupColumn(_items, tr("Item"), 12, _itemLookup);
    new TextColumn(_items, tr("Description"), 20);
    new TextColumn(_items, tr("Size"), 8);
    new NumberColumn(_items, tr("Quantity"), 6);
    new MoneyColumn(_items, tr("Total Cost"), 8);

    _size = new QComboBox(_items);
    new LookupEditor(_items, 0, new ItemEdit(_itemLookup, _items));
    new ComboEditor(_items, 2, _size);
    new NumberEditor(_items, 3, new DoubleEdit(_items));
    new NumberEditor(_items, 4, new MoneyEdit(_items));

    QGridLayout* itemGrid = new QGridLayout(items);
    itemGrid->setSpacing(6);
    itemGrid->setMargin(3);
    itemGrid->setColStretch(0, 1);
    itemGrid->addWidget(_items, 0, 0);

    _accounts = new Table(accounts);
    _accounts->setVScrollBarMode(QScrollView::AlwaysOn);
    _accounts->setDisplayRows(10);
    _accounts->setLeftMargin(fontMetrics().width("99999"));
    connect(_accounts, SIGNAL(cellChanged(int,int,Variant)),
	    SLOT(accountCellChanged(int,int,Variant)));
    connect(_accounts, SIGNAL(focusNext(bool&,int&,int&,int)),
	    SLOT(accountFocusNext(bool&,int&,int&,int)));

    AccountLookup* acctLookup = new AccountLookup(_main, this);

    new LookupColumn(_accounts, tr("Account"), 30, acctLookup);
    new MoneyColumn(_accounts, tr("Debit"), 10);
    new MoneyColumn(_accounts, tr("Credit"), 10);

    new LookupEditor(_accounts, 0, new LookupEdit(acctLookup, _accounts));
    new NumberEditor(_accounts, 1, new MoneyEdit(_accounts));
    new NumberEditor(_accounts, 2, new MoneyEdit(_accounts));

    QGridLayout* accountGrid = new QGridLayout(accounts);
    accountGrid->setSpacing(6);
    accountGrid->setMargin(3);
    accountGrid->setColStretch(0, 1);
    accountGrid->addWidget(_accounts, 0, 0);

    QFrame* bot = new QFrame(frame);

    QLabel* accountLabel = new QLabel(tr("Account:"), bot);
    _account = new LookupEdit(new AccountLookup(_main, this), bot);
    _account->setLength(30);
    accountLabel->setBuddy(_account);

    QLabel* totalLabel = new QLabel(tr("Total:"), bot);
    _total = new MoneyEdit(bot);
    _total->setFocusPolicy(NoFocus);
    totalLabel->setBuddy(_total);

    QGridLayout* botGrid = new QGridLayout(bot);
    botGrid->setSpacing(6);
    botGrid->setMargin(3);
    botGrid->setColStretch(2, 1);
    botGrid->addWidget(accountLabel, 0, 0);
    botGrid->addWidget(_account, 0, 1, AlignLeft | AlignVCenter);
    botGrid->addWidget(totalLabel, 0, 3);
    botGrid->addWidget(_total, 0, 4, AlignLeft | AlignVCenter);

    QFrame* buttons = new QFrame(frame);
    QPushButton* import = new QPushButton(tr("Import"), buttons);
    QPushButton* post = new QPushButton(tr("Post"), buttons);
    QPushButton* cancel = new QPushButton(tr("Cancel"), buttons);

    connect(import, SIGNAL(clicked()), SLOT(slotImport()));
    connect(post, SIGNAL(clicked()), SLOT(slotPost()));
    connect(cancel, SIGNAL(clicked()), SLOT(close()));

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(6);
    buttonGrid->setMargin(3);
    buttonGrid->setColStretch(1, 1);
    buttonGrid->addWidget(import, 0, 0);
    buttonGrid->addWidget(post, 0, 2);
    buttonGrid->addWidget(cancel, 0, 3);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(3);
    grid->addWidget(top, 0, 0);
    grid->addWidget(tabs, 1, 0);
    grid->addWidget(bot, 2, 0);
    grid->addWidget(buttons, 3, 0);

    Company company;
    _quasar->db()->lookup(company);

    _store->setId(_quasar->defaultStore(true));
    _station->setId(_quasar->defaultStation());
    _employee->setId(_quasar->defaultEmployee());
    _account->setId(company.historicalBalancing());

    _customers->appendRow(new VectorRow(_customers->columns()));
    _vendors->appendRow(new VectorRow(_vendors->columns()));
    _items->appendRow(new VectorRow(_items->columns()));
    _accounts->appendRow(new VectorRow(_accounts->columns()));

#if 0
    ItemSelect conditions;
    vector<Item> v_items;
    _quasar->db()->select(v_items, conditions);
    for (unsigned int i = 0; i < v_items.size(); ++i) {
	Item& item = v_items[i];
	for (unsigned int j = 0; j < item.vendors().size(); ++j) {
	    ItemVendor& vendor = item.vendors()[j];

	    bool found = false;
	    for (unsigned int k = 0; k < item.numbers().size(); ++k) {
		if (item.numbers()[k].number == vendor.number) {
		    found = true;
		    break;
		}
	    }
	    if (found) continue;

	    ItemPlu info;
	    info.number = vendor.number;

	    Item orig = item;
	    item.numbers().push_back(info);
	    _quasar->db()->update(orig, item);
	}
    }
#endif

    setCentralWidget(frame);
    setCaption(tr("Open Balances"));
    finalize();
}
Example #12
0
void ndManager::setupActions()
{
    //File Menu
    QMenu *fileMenu = menuBar()->addMenu(tr("&File"));

    mNewAction = fileMenu->addAction(tr("&New..."));
    mNewAction->setIcon(QPixmap(":/shared-icons/document-new"));
    mNewAction->setShortcut(QKeySequence::New);
    connect(mNewAction, SIGNAL(triggered()), this, SLOT(slotNewFile()));


    mOpenAction = fileMenu->addAction(tr("&Open..."));
    mOpenAction->setIcon(QPixmap(":/shared-icons/document-open"));
    mOpenAction->setShortcut(QKeySequence::Open);
    connect(mOpenAction, SIGNAL(triggered()), this, SLOT(slotFileOpen()));

    mFileOpenRecent = new QRecentFileAction(this);
    QSettings settings;
    mFileOpenRecent->setRecentFiles(settings.value(QLatin1String("Recent Files"),QStringList()).toStringList());
    fileMenu->addAction(mFileOpenRecent);
    connect(mFileOpenRecent, SIGNAL(recentFileSelected(QString)), this, SLOT(slotFileOpenRecent(QString)));
    connect(mFileOpenRecent, SIGNAL(recentFileListChanged()), this, SLOT(slotSaveRecentFiles()));

    mUseTemplateAction = fileMenu->addAction(tr("Use &Template..."));
    connect(mUseTemplateAction, SIGNAL(triggered()), this, SLOT(slotImport()));

    fileMenu->addSeparator();
    mSaveAction = fileMenu->addAction(tr("Save..."));
    mSaveAction->setIcon(QPixmap(":/shared-icons/document-save"));
    mSaveAction->setShortcut(QKeySequence::Save);
    connect(mSaveAction, SIGNAL(triggered()), this, SLOT(slotSave()));

    mSaveAsAction = fileMenu->addAction(tr("&Save As..."));
    mSaveAsAction->setIcon(QPixmap(":/shared-icons/document-save-as"));
    mSaveAsAction->setShortcut(QKeySequence::SaveAs);
    connect(mSaveAsAction, SIGNAL(triggered()), this, SLOT(slotSaveAs()));


    mSaveAsDefaultAction = fileMenu->addAction(tr("Save as &Default"));
    connect(mSaveAsDefaultAction, SIGNAL(triggered()), this, SLOT(slotSaveDefault()));

    mReloadAction = fileMenu->addAction(tr("&Reload"));
    mReloadAction->setShortcut(Qt::Key_F5);
    connect(mReloadAction, SIGNAL(triggered()), this, SLOT(slotReload()));


    fileMenu->addSeparator();


    mCloseAction = fileMenu->addAction(tr("Close"));
    mCloseAction->setIcon(QPixmap(":/shared-icons/document-close"));
    mCloseAction->setShortcut(QKeySequence::Close);
    connect(mCloseAction, SIGNAL(triggered()), this, SLOT(slotFileClose()));


    fileMenu->addSeparator();

    mQuitAction = fileMenu->addAction(tr("Quit"));
    mQuitAction->setIcon(QPixmap(":/shared-icons/window-close"));
    mQuitAction->setShortcut(QKeySequence::Quit);
    connect(mQuitAction, SIGNAL(triggered()), this, SLOT(close()));


    QMenu *actionMenu = menuBar()->addMenu(tr("&Actions"));
    mQueryAction = actionMenu->addAction(tr("&Query"));
#ifndef Q_OS_UNIX
    mQueryAction->setEnabled(false);
#endif
    connect(mQueryAction, SIGNAL(triggered()), this, SLOT(slotQuery()));

    //mProcessingManager = actionMenu->addAction(tr("Show Processing Manager"));

    QMenu *settingsMenu = menuBar()->addMenu(tr("&Settings"));

    //Settings
    mExpertMode = settingsMenu->addAction(tr("&Expert Mode"));
    mExpertMode->setCheckable(true);
    connect(mExpertMode, SIGNAL(triggered(bool)), this, SLOT(slotExpertMode()));
    settingsMenu->addSeparator();

    settings.beginGroup("General");
    if ( settings.contains("expertMode")) mExpertMode->setChecked(settings.value("expertMode").toBool());
	 else mExpertMode->setChecked(true);
    settings.endGroup();

    viewMainToolBar = settingsMenu->addAction(tr("Show Main Toolbar"));

    viewMainToolBar->setCheckable(true);
    viewMainToolBar->setChecked(true);
    connect(viewMainToolBar,SIGNAL(triggered()), this,SLOT(slotViewMainToolBar()));


    viewStatusBar = settingsMenu->addAction(tr("Show StatusBar"));
    viewStatusBar->setCheckable(true);
    connect(viewStatusBar,SIGNAL(triggered()), this,SLOT(slotViewStatusBar()));
    viewStatusBar->setChecked(true);

    QMenu *helpMenu = menuBar()->addMenu(tr("Help"));
    QAction *handbook = helpMenu->addAction(tr("Handbook"));
    handbook->setShortcut(Qt::Key_F1);
    connect(handbook,SIGNAL(triggered()), this,SLOT(slotHanbook()));

    QAction *about = helpMenu->addAction(tr("About"));
    connect(about,SIGNAL(triggered()), this,SLOT(slotAbout()));

    mMainToolBar->addAction(mNewAction);
    mMainToolBar->addAction(mOpenAction);
    mMainToolBar->addAction(mSaveAction);

    resize(800,600);
}