kplato

kptaccountspanel.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2005 Dag Andersen <danders@get2net.dk>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation;
00007    version 2 of the License.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KPTACCOUNTSPANEL_H
00021 #define KPTACCOUNTSPANEL_H
00022 
00023 #include "kptaccountspanelbase.h"
00024 
00025 #include <qptrlist.h>
00026 #include <qdict.h>
00027 
00028 class QListView;
00029 class QListViewItem;
00030 class QWidget;
00031 
00032 class KCommand;
00033 class KMacroCommand;
00034 
00035 namespace KPlato
00036 {
00037 
00038 class AccountItem;
00039 class Account;
00040 class Accounts;
00041 class Part;
00042 class Project;
00043 
00044 class AccountsPanel : public AccountsPanelBase {
00045     Q_OBJECT
00046 public:
00047     AccountsPanel(Accounts &acc, QWidget *parent=0, const char *name=0);
00048     
00049     KCommand *buildCommand(Part *part);
00050     
00051     bool isUnique(QListViewItem *item);
00052     void renameStopped(QListViewItem *item);
00053     
00054 signals:
00055     void changed(bool);
00056     
00057     // Internal
00058     void renameStarted(QListViewItem *, int);
00059     void startRename(QListViewItem *item, int col);
00060     void selectionChanged();
00061     
00062 public slots:
00063     void slotOk();
00064     
00065 protected slots:
00066     void slotChanged();
00067     void slotSelectionChanged();
00068     void slotItemRenamed(QListViewItem *item, int col);
00069     void slotRemoveBtn();
00070     void slotNewBtn();
00071     void slotSubBtn();
00072     void slotActivated(int);
00073     void slotListDoubleClicked(QListViewItem* item, const QPoint&, int col);
00074     void slotRenameStarted(QListViewItem *item, int col);
00075     void slotStartRename(QListViewItem *item, int col);
00076     void slotRemoveItem(QListViewItem *i);
00077 protected:
00078     void addItems(QListView *lv, Accounts &acc);
00079     void addItems(QListViewItem *item, Account *acc);
00080     void addElement(const QListViewItem *item);
00081     void removeElement(QListViewItem *item);
00082     void refreshDefaultAccount();
00083     KCommand *save(Part *part, Project &project);
00084     KCommand *save(Part *part, Project &project, QListViewItem *item);
00085     
00086 private:
00087     Accounts &m_accounts;
00088     
00089     QPtrList<QListViewItem> m_removedItems;
00090     Account *m_oldDefaultAccount;
00091     QDict<QListViewItem> m_elements;
00092     int m_currentIndex;
00093     QString m_renameText;
00094     QListViewItem *m_renameItem;
00095 };
00096 
00097 } //namespace KPlato
00098 
00099 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys