54
AccountseditorConfigDialog::AccountseditorConfigDialog( ViewBase *view, AccountTreeView *treeview, QWidget *p)
57
m_treeview( treeview )
59
setCaption( i18n("Settings") );
60
setButtons( Ok|Cancel );
61
setDefaultButton( Ok );
62
showButtonSeparator( true );
64
QTabWidget *tab = new QTabWidget();
66
QWidget *w = ViewBase::createPageLayoutWidget( view );
67
tab->addTab( w, w->windowTitle() );
68
m_pagelayout = w->findChild<KoPageLayoutWidget*>();
69
Q_ASSERT( m_pagelayout );
71
m_headerfooter = ViewBase::createHeaderFooterWidget( view );
72
m_headerfooter->setOptions( view->printingOptions() );
73
tab->addTab( m_headerfooter, m_headerfooter->windowTitle() );
75
KPageWidgetItem *page = addPage( tab, i18n( "Printing" ) );
76
page->setHeader( i18n( "Printing Options" ) );
78
connect( this, SIGNAL(okClicked()), this, SLOT(slotOk()));
81
void AccountseditorConfigDialog::slotOk()
84
m_view->setPageLayout( m_pagelayout->pageLayout() );
85
m_view->setPrintingOptions( m_headerfooter->options() );
52
89
//--------------------
53
90
AccountTreeView::AccountTreeView( QWidget *parent )
54
91
: TreeViewBase( parent )
125
162
//-----------------------------------
126
AccountsEditor::AccountsEditor( KoDocument *part, QWidget *parent )
127
: ViewBase( part, parent )
163
AccountsEditor::AccountsEditor(KoPart *part, KoDocument *doc, QWidget *parent)
164
: ViewBase(part, doc, parent)
134
171
l->addWidget( m_view );
135
172
m_view->setEditTriggers( m_view->editTriggers() | QAbstractItemView::EditKeyPressed );
137
connect( model(), SIGNAL( executeCommand( KUndo2Command* ) ), part, SLOT( addCommand( KUndo2Command* ) ) );
174
connect( model(), SIGNAL( executeCommand( KUndo2Command* ) ), doc, SLOT( addCommand( KUndo2Command* ) ) );
139
176
connect( m_view, SIGNAL( currentChanged( QModelIndex ) ), this, SLOT( slotCurrentChanged( QModelIndex ) ) );
141
178
connect( m_view, SIGNAL( selectionChanged( const QModelIndexList ) ), this, SLOT( slotSelectionChanged( const QModelIndexList ) ) );
143
180
connect( m_view, SIGNAL( contextMenuRequested( QModelIndex, const QPoint& ) ), this, SLOT( slotContextMenuRequested( QModelIndex, const QPoint& ) ) );
181
connect( m_view, SIGNAL( headerContextMenuRequested( const QPoint& ) ), SLOT( slotHeaderContextMenuRequested( const QPoint& ) ) );
146
184
void AccountsEditor::updateReadWrite( bool readwrite )
173
211
void AccountsEditor::slotContextMenuRequested( QModelIndex index, const QPoint& pos )
175
213
kDebug(planDbg())<<index.row()<<","<<index.column()<<":"<<pos;
177
if ( index.isValid() ) {
178
Account *a = m_view->model()->account( index );
180
name = "accountseditor_accounts_popup";
182
name = "accountseditor_popup";
214
slotHeaderContextMenuRequested( pos );
217
void AccountsEditor::slotHeaderContextMenuRequested( const QPoint &pos )
220
QList<QAction*> lst = contextActionList();
221
if ( ! lst.isEmpty() ) {
222
QMenu::exec( lst, pos, lst.first() );
185
kDebug(planDbg())<<name;
186
emit requestPopupMenu( name, pos );
189
226
Account *AccountsEditor::currentAccount() const
225
262
QString name = "accountseditor_edit_list";
227
actionAddAccount = new KAction(KIcon( "document-new" ), i18n("Add Account"), this);
264
actionAddAccount = new KAction(koIcon("document-new"), i18n("Add Account"), this);
228
265
actionCollection()->addAction("add_account", actionAddAccount );
229
266
actionAddAccount->setShortcut( KShortcut( Qt::CTRL + Qt::Key_I ) );
230
267
connect( actionAddAccount, SIGNAL( triggered( bool ) ), SLOT( slotAddAccount() ) );
231
268
addAction( name, actionAddAccount );
233
actionAddSubAccount = new KAction(KIcon( "document-new" ), i18n("Add Subaccount"), this);
270
actionAddSubAccount = new KAction(koIcon("document-new"), i18n("Add Subaccount"), this);
234
271
actionCollection()->addAction("add_subaccount", actionAddSubAccount );
235
272
actionAddSubAccount->setShortcut( KShortcut( Qt::SHIFT + Qt::CTRL + Qt::Key_I ) );
236
273
connect( actionAddSubAccount, SIGNAL( triggered( bool ) ), SLOT( slotAddSubAccount() ) );
237
274
addAction( name, actionAddSubAccount );
239
actionDeleteSelection = new KAction(KIcon( "edit-delete" ), i18nc( "@action", "Delete"), this);
276
actionDeleteSelection = new KAction(koIcon("edit-delete"), i18nc("@action", "Delete"), this);
240
277
actionCollection()->addAction("delete_selection", actionDeleteSelection );
241
278
actionDeleteSelection->setShortcut( KShortcut( Qt::Key_Delete ) );
242
279
connect( actionDeleteSelection, SIGNAL( triggered( bool ) ), SLOT( slotDeleteSelection() ) );
243
280
addAction( name, actionDeleteSelection );
282
createOptionAction();
285
void AccountsEditor::slotOptions()
288
AccountseditorConfigDialog *dlg = new AccountseditorConfigDialog( this, m_view, this );
289
connect(dlg, SIGNAL(finished(int)), SLOT(slotOptionsFinished(int)));
292
dlg->activateWindow();
247
295
void AccountsEditor::slotAddAccount()