Ejemplo n.º 1
0
void KrecipesView::enableSaveOptionSlot( bool enabled )
{
	recipeButton->setEnabled( enabled );

	if ( enabled )
		recipeButton->show();
	else 
		recipeButton->hide();

	emit enableSaveOption( enabled );
}
Krecipes::Krecipes(): KXmlGuiWindow( 0 )
{
    m_view = new KrecipesView( this );
    setObjectName( "Krecipes" );
    // accept dnd
    setAcceptDrops( true );

    // tell the KMainWindow that this is indeed the main widget
    setCentralWidget( m_view );

    // then, setup our actions
    setupActions();

    // and a status bar
    statusBar() ->show();
    statusLabel = new QLabel;
    statusBar()->addPermanentWidget( statusLabel );

    // apply the saved mainwindow settings, if any, and ask the mainwindow
    // to automatically save settings if changed: window size, toolbar
    // position, icon size, etc.
    setAutoSaveSettings();


    // allow the view to change the statusbar and caption
    connect( m_view, SIGNAL( signalChangeStatusbar( const QString& ) ),
             this, SLOT( changeStatusbar( const QString& ) ) );
    connect( m_view, SIGNAL( signalChangeCaption( const QString& ) ),
             this, SLOT( changeCaption( const QString& ) ) );

    connect( m_view, SIGNAL( panelShown( KrePanel, bool ) ), SLOT( updateActions( KrePanel, bool ) ) );

    connect( m_view, SIGNAL( recipeSelected(bool) ), SLOT( recipeSelected(bool) ) );


    // Enable/Disable the Save Button (Initialize disabled, and connect signal)

    connect( m_view, SIGNAL( enableSaveOption( bool ) ), this, SLOT( enableSaveOption( bool ) ) );

    enableSaveOption( false ); // Disables saving initially
    recipeSelected( false ); //nothing is selected initially

    parsing_file_dlg = new KDialog( this );
    parsing_file_dlg->setObjectName( "parsing_file_dlg" );
    parsing_file_dlg->setModal( true );
    //parsing_file_dlg->setWindowFlags ( Qt::WX11BypassWM );
    QLabel *parsing_file_dlg_label = new QLabel( i18n( "Gathering recipe data from file.\nPlease wait..." ), parsing_file_dlg );
    parsing_file_dlg_label->setFrameStyle( QFrame::Box | QFrame::Raised );
    //( new QVBoxLayout( parsing_file_dlg ) ) ->addWidget( parsing_file_dlg_label );
    parsing_file_dlg->setMainWidget( parsing_file_dlg_label );
    parsing_file_dlg->adjustSize();
    //parsing_file_dlg->setFixedSize(parsing_file_dlg->size());
    convertDialog = new ConversionDialog(this,m_view->database);
}