Esempio n. 1
0
KACLEditWidget::KACLEditWidget( QWidget *parent )
    : QWidget(parent), d(new KACLEditWidgetPrivate)
{
    QHBoxLayout *hbox = new QHBoxLayout( this );
    hbox->setMargin( 0 );
    d->m_listView = new KACLListView(this);
    hbox->addWidget(d->m_listView);
    connect(d->m_listView->selectionModel(),
            SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection& )),
            this,
            SLOT(_k_slotUpdateButtons()));
    QVBoxLayout *vbox = new QVBoxLayout();
    hbox->addLayout( vbox );
    d->m_AddBtn = new QPushButton(i18n("Add Entry..."), this);
    vbox->addWidget(d->m_AddBtn);
    d->m_AddBtn->setObjectName(QLatin1String("add_entry_button"));
    connect(d->m_AddBtn, SIGNAL(clicked()), d->m_listView, SLOT(slotAddEntry()));
    d->m_EditBtn = new QPushButton(i18n("Edit Entry..."), this);
    vbox->addWidget(d->m_EditBtn);
    d->m_EditBtn->setObjectName(QLatin1String("edit_entry_button"));
    connect(d->m_EditBtn, SIGNAL(clicked()), d->m_listView, SLOT(slotEditEntry()));
    d->m_DelBtn = new QPushButton(i18n("Delete Entry"), this);
    vbox->addWidget(d->m_DelBtn);
    d->m_DelBtn->setObjectName(QLatin1String("delete_entry_button"));
    connect(d->m_DelBtn, SIGNAL(clicked()), d->m_listView, SLOT(slotRemoveEntry()));
    vbox->addItem( new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Expanding ) );
    d->_k_slotUpdateButtons();
}
Esempio n. 2
0
KACLEditWidget::KACLEditWidget(QWidget *parent, const char *name) : QWidget(parent, name)
{
    QHBox *hbox = new QHBox(parent);
    hbox->setSpacing(KDialog::spacingHint());
    m_listView = new KACLListView(hbox, "acl_listview");
    connect(m_listView, SIGNAL(selectionChanged()), this, SLOT(slotUpdateButtons()));
    QVBox *vbox = new QVBox(hbox);
    vbox->setSpacing(KDialog::spacingHint());
    m_AddBtn = new QPushButton(i18n("Add Entry..."), vbox, "add_entry_button");
    connect(m_AddBtn, SIGNAL(clicked()), m_listView, SLOT(slotAddEntry()));
    m_EditBtn = new QPushButton(i18n("Edit Entry..."), vbox, "edit_entry_button");
    connect(m_EditBtn, SIGNAL(clicked()), m_listView, SLOT(slotEditEntry()));
    m_DelBtn = new QPushButton(i18n("Delete Entry"), vbox, "delete_entry_button");
    connect(m_DelBtn, SIGNAL(clicked()), m_listView, SLOT(slotRemoveEntry()));
    QWidget *spacer = new QWidget(vbox);
    spacer->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    slotUpdateButtons();
}
Esempio n. 3
0
KonqSidebarHistoryModule::KonqSidebarHistoryModule( KonqSidebarTree * parentTree, const char *name )
    : QObject( 0L, name ), KonqSidebarTreeModule( parentTree ),
      m_dict( 349 ),
      m_topLevelItem( 0L ),
      m_dlg( 0L ),
      m_initialized( false )
{
    if ( !s_settings ) {
	sd.setObject( s_settings,
                      new KonqSidebarHistorySettings( 0, "history settings" ));
	s_settings->readSettings( true );
    }

    connect( s_settings, SIGNAL( settingsChanged() ), SLOT( slotSettingsChanged() ));

    m_dict.setAutoDelete( true );
    m_currentTime = QDateTime::currentDateTime();

    KConfig *kc = KGlobal::config();
    KConfigGroupSaver cs( kc, "HistorySettings" );
    m_sortsByName = kc->readEntry( "SortHistory", "byDate" ) == "byName";


    KonqHistoryManager *manager = KonqHistoryManager::kself();

    connect( manager, SIGNAL( loadingFinished() ), SLOT( slotCreateItems() ));
    connect( manager, SIGNAL( cleared() ), SLOT( clear() ));

    connect( manager, SIGNAL( entryAdded( const KonqHistoryEntry * ) ),
	     SLOT( slotEntryAdded( const KonqHistoryEntry * ) ));
    connect( manager, SIGNAL( entryRemoved( const KonqHistoryEntry *) ),
	     SLOT( slotEntryRemoved( const KonqHistoryEntry *) ));

    connect( parentTree, SIGNAL( expanded( QListViewItem * )),
	     SLOT( slotItemExpanded( QListViewItem * )));

    m_collection = new KActionCollection( this, "history actions" );
    (void) new KAction( i18n("New &Window"), "window_new", 0, this,
 			SLOT( slotNewWindow() ), m_collection, "open_new");
    (void) new KAction( i18n("&Remove Entry"), "editdelete", 0, this,
			SLOT( slotRemoveEntry() ), m_collection, "remove");
    (void) new KAction( i18n("C&lear History"), "history_clear", 0, this,
			SLOT( slotClearHistory() ), m_collection, "clear");
    (void) new KAction( i18n("&Preferences..."), "configure", 0, this,
			SLOT( slotPreferences()), m_collection, "preferences");

    KRadioAction *sort;
    sort = new KRadioAction( i18n("By &Name"), 0, this,
			     SLOT( slotSortByName() ), m_collection, "byName");
    sort->setExclusiveGroup("SortGroup");
    sort->setChecked( m_sortsByName );

    sort = new KRadioAction( i18n("By &Date"), 0, this,
			     SLOT( slotSortByDate() ), m_collection, "byDate");
    sort->setExclusiveGroup("SortGroup");
    sort->setChecked( !m_sortsByName );

    m_folderClosed = SmallIcon( "folder" );
    m_folderOpen = SmallIcon( "folder_open" );

    slotSettingsChanged(); // read the settings
}