Commit e98d90ad authored by Emmanuel Lepage's avatar Emmanuel Lepage

More polishing for release

parent 2a57613e
......@@ -30,6 +30,7 @@
<Action name="action_displayVolumeControls" />
<Action name="action_displayDialpad" />
<Separator />
<Action name="action_configureShortcut" />
<Action name="action_configureSflPhone" />
<Separator />
<Action name="action_accountCreationWizard" />
......
......@@ -21,6 +21,7 @@
#include "AccountListModel.h"
#include "lib/sflphone_const.h"
#include "conf/ConfigAccountList.h"
#include <QDebug>
AccountListModel::AccountListModel(QObject *parent)
......
......@@ -23,7 +23,8 @@
#include <QAbstractListModel>
#include "conf/ConfigAccountList.h"
//SFLPhone
class ConfigAccountList;
/**
@author Jérémy Quentin <jeremy.quentin@gmail.com>
......@@ -41,8 +42,6 @@ public:
QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
int rowCount(const QModelIndex & parent = QModelIndex()) const;
// int columnCount(const QModelIndex & parent = QModelIndex()) const;
// QVariant headerData(int section , Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex & index) const;
virtual bool setData ( const QModelIndex & index, const QVariant &value, int role);
......@@ -52,9 +51,6 @@ public:
bool addAccount( QString alias );
QString getOrderedList() const;
// QStringList getActiveCodecList() const ;
// void setActiveCodecList(const QStringList & activeCodecListToSet);
};
#endif
#include "AccountView.h"
#include <QDebug>
#include <QtGui/QListWidgetItem>
#include "lib/sflphone_const.h"
#include "lib/configurationmanager_interface_singleton.h"
///Constructor
AccountView::AccountView() : Account(), item2(0), itemWidget(0)
{
}
///Init
void AccountView::initItem()
{
if(item2 != NULL)
......@@ -20,6 +22,7 @@ void AccountView::initItem()
initItemWidget();
}
///Init widget
void AccountView::initItemWidget()
{
if(itemWidget != NULL)
......@@ -39,16 +42,19 @@ void AccountView::initItemWidget()
connect(itemWidget, SIGNAL(checkStateChanged(bool)), this, SLOT(setEnabled(bool)));
}
///Get the current item
QListWidgetItem* AccountView::getItem()
{
return item2;
}
///Get the current widget
AccountItemWidget* AccountView::getItemWidget()
{
return itemWidget;
}
///Return the state color
QColor AccountView::getStateColor()
{
if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_UNREGISTERED)
......@@ -58,7 +64,7 @@ QColor AccountView::getStateColor()
return Qt::red;
}
///Get the color name
QString AccountView::getStateColorName()
{
if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_UNREGISTERED)
......@@ -68,11 +74,13 @@ QString AccountView::getStateColorName()
return "red";
}
///Is this item checked?
bool AccountView::isChecked() const
{
return itemWidget->getEnabled();
}
///Build an item from an account id
AccountView* AccountView::buildExistingAccountFromId(QString _accountId)
{
//Account* a = Account::buildExistingAccountFromId( _accountId);
......@@ -84,6 +92,7 @@ AccountView* AccountView::buildExistingAccountFromId(QString _accountId)
return a;
}
///Build an item from an alias
AccountView* AccountView::buildNewAccountFromAlias(QString alias)
{
//Account* a = Account::buildNewAccountFromAlias(alias);
......@@ -94,6 +103,7 @@ AccountView* AccountView::buildNewAccountFromAlias(QString alias)
return a;
}
///Change LED color
void AccountView::updateState()
{
qDebug() << "updateState";
......
#ifndef ACCOUNT_VIEW_H
#define ACCOUNT_VIEW_H
#include <QtGui/QListWidgetItem>
#include "lib/Item.h"
#include "lib/Account.h"
#include "widgets/AccountItemWidget.h"
#include "lib/sflphone_const.h"
//Qt
class QListWidgetItem;
//SFLPhone
class AccountItemWidget;
class AccountView : public Account, public Item<AccountItemWidget> {
public:
......
......@@ -24,6 +24,10 @@
#include <QFormLayout>
#include "lib/sflphone_const.h"
#include "lib/configurationmanager_interface_singleton.h"
#include <QLabel>
#include <QRadioButton>
#include <QLineEdit>
#include <QCheckBox>
#include <klocale.h>
......
......@@ -22,11 +22,12 @@
#define ACCOUNTWIZARD_H
#include <QWizard>
#include <QLabel>
#include <QRadioButton>
#include <QLineEdit>
#include <QCheckBox>
//Qt
class QLabel;
class QRadioButton;
class QLineEdit;
class QCheckBox;
/**
@author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com>
......
......@@ -2,7 +2,6 @@
#include <QtCore/QTimer>
#include <akonadi/control.h>
#include <akonadi/collectionfilterproxymodel.h>
#include <akonadi/collectionmodel.h>
#include <akonadi/kmime/messagemodel.h>
#include <kabc/contactgroup.h>
#include <kabc/phonenumber.h>
......@@ -13,11 +12,19 @@
#include <akonadi/contact/contacteditor.h>
#include <kdialog.h>
#include <QObject>
#include <akonadi/session.h>
#include <kabc/addressee.h>
#include <kabc/addresseelist.h>
#include "lib/Contact.h"
#include "SFLPhone.h"
#include "SFLPhoneView.h"
///Init static attributes
AkonadiBackend* AkonadiBackend::m_pInstance = 0;
///Constructor
AkonadiBackend::AkonadiBackend(QObject* parent) : ContactBackend(parent)
{
//QTimer::singleShot( 0, this, SLOT( delayedInit() ) );
......@@ -29,11 +36,13 @@ AkonadiBackend::AkonadiBackend(QObject* parent) : ContactBackend(parent)
connect( job, SIGNAL( collectionsReceived( const Akonadi::Collection::List& ) ), this, SLOT( collectionsReceived( const Akonadi::Collection::List& ) ) );
}
///Destructor
AkonadiBackend::~AkonadiBackend()
{
}
///Singleton
ContactBackend* AkonadiBackend::getInstance()
{
if (m_pInstance == NULL) {
......@@ -42,6 +51,7 @@ ContactBackend* AkonadiBackend::getInstance()
return m_pInstance;
}
///Update the contact list when a new Akonadi collection is added
ContactList AkonadiBackend::update(Akonadi::Collection collection)
{
m_pCollection = collection;
......@@ -95,22 +105,25 @@ ContactList AkonadiBackend::update(Akonadi::Collection collection)
return contacts;
}
///Update the contact list even without a new collection
ContactList AkonadiBackend::update_slot()
{
return update(m_pCollection);
}
///Find contact using a phone number
Contact* AkonadiBackend::getContactByPhone(QString phoneNumber)
{
return m_pContactByPhone[phoneNumber];
}
///Find contact by UID
Contact* AkonadiBackend::getContactByUid(QString uid)
{
return m_pContactByUid[uid];
}
///Called when a new collection is added
void AkonadiBackend::collectionsReceived( const Akonadi::Collection::List& list)
{
foreach (Akonadi::Collection coll, list) {
......@@ -119,6 +132,7 @@ void AkonadiBackend::collectionsReceived( const Akonadi::Collection::List& list
}
}
///Edit backend value using an updated frontend contact
void AkonadiBackend::editContact(Contact* contact)
{
KABC::Addressee ct = m_pAddrHash[contact->getUid()];
......@@ -135,6 +149,7 @@ void AkonadiBackend::editContact(Contact* contact)
dlg->exec();
}
///Add a new contact
void AkonadiBackend::addNewContact(Contact* contact)
{
KABC::Addressee newContact;
......@@ -177,8 +192,6 @@ void AkonadiBackend::addNewContact(Contact* contact)
dlg->setMainWidget(editor);
dlg->exec();
if ( !editor->saveContact() ) {
qDebug() << "Unable to save new contact to storage";
return;
......
#ifndef AKONADI_BACKEND_H
#define AKONADI_BACKEND_H
#include <QObject>
#include <akonadi/session.h>
#include <akonadi/collectionmodel.h>
#include <kabc/addressee.h>
#include <kabc/addresseelist.h>
#include <lib/ContactBackend.h>
#include <akonadi/collectionmodel.h>
class Contact;
//Qt
class QObject;
//KDE
namespace KABC {
class Addressee;
class AddresseeList;
}
namespace Akonadi {
class Session;
class CollectionModel;
class Collection;
}
//SFLPhone
class Contact;
typedef QList<Contact*> ContactList;
class AkonadiBackend : public ContactBackend {
......
#include "CallView.h"
#include "AkonadiBackend.h"
#include "lib/Contact.h"
#include "lib/sflphone_const.h"
#include "lib/callmanager_interface_singleton.h"
#include "widgets/CallTreeItem.h"
#include "SFLPhone.h"
#include "SFLPhoneView.h"
#include <QtGui/QInputDialog>
#include <QtGui/QTreeWidget>
#include <QtGui/QTreeWidgetItem>
///Retrieve current and older calls from the daemon, fill history and the calls TreeView and enable drag n' drop
CallView::CallView(QWidget* parent) : QTreeWidget(parent)
{
// if (type == ActiveCall)
// SFLPhone::model()->initCall();
// else if (type == History)
// SFLPhone::model()->initHistory();
//Widget part
setAcceptDrops(true);
setDragEnabled(true);
......
#ifndef CALL_VIEW
#define CALL_VIEW
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QItemDelegate>
#include <QtGui/QItemDelegate>
#include <QtGui/QTreeWidget>
#include "lib/CallModel.h"
#include "lib/sflphone_const.h"
#include "lib/callmanager_interface_singleton.h"
#include "widgets/CallTreeItem.h"
//Qt
class QTreeWidgetItem;
//SFLPhone
class CallTreeItem;
class CallTreeItemDelegate : public QItemDelegate
{
......
This diff is collapsed.
......@@ -17,51 +17,48 @@
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
**************************************************************************/
#ifndef SFLPHONE_H
#define SFLPHONE_H
#include <QtCore/QString>
#include <QtCore/QVector>
#include <QtGui/QListWidgetItem>
#include <QtGui/QKeyEvent>
#include <QErrorMessage>
#include <KSystemTrayIcon>
#include <KNotification>
#include <KXmlGuiWindow>
#include <KAction>
#include "widgets/ContactDock.h"
#include "widgets/HistoryDock.h"
#include "widgets/BookmarkDock.h"
#include <QActionGroup>
// #include "ui_SFLPhoneView_base.h"
//#include "CallList.h"
#include "AccountWizard.h"
#include "lib/Contact.h"
#include "SFLPhoneView.h"
#include "widgets/SFLPhoneTray.h"
#include <QtCore/QVector>
#include <lib/CallModel.h>
//Qt
class QString;
class QLabel;
class QTreeWidgetItem;
class QActionGroup;
//KDE
class KAction;
//SFLPhone
class Call;
class ContactDock;
class BookmarkDock;
class SFLPhoneTray;
class SFLPhoneView;
class CallView;
class HistoryDock;
class CallTreeItem;
typedef CallModel<CallTreeItem*,QTreeWidgetItem*> TreeWidgetCallModel;
/**
* This class represents the SFLphone main window
* It implements the methods relative to windowing
* (status, menus, toolbars, notifications...).
* It uses a view which implements the real functionning
* and features of the phone.
* The display of the window is according to the state of the view,
* so the view sends some signals to ask for changes on the window
* that the window has to take into account.
*
* @short Main window
* @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com>
* @version 0.9.6
/**
* This class represents the SFLphone main window
* It implements the methods relative to windowing
* (status, menus, toolbars, notifications...).
* It uses a view which implements the real functionning
* and features of the phone.
* The display of the window is according to the state of the view,
* so the view sends some signals to ask for changes on the window
* that the window has to take into account.
*
* @short Main window
* @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com>
* @version 0.9.6
**/
class SFLPhone : public KXmlGuiWindow
{
......@@ -80,7 +77,7 @@ enum CallAction {
private:
// Whether or not the object has been initialized
bool initialized_;
bool m_pInitialized;
KAction* action_accept ;
KAction* action_refuse ;
KAction* action_hold ;
......@@ -93,20 +90,19 @@ private:
KAction* action_displayVolumeControls ;
KAction* action_displayDialpad ;
KAction* action_configureSflPhone ;
KAction* action_configureShortcut ;
KAction* action_accountCreationWizard ;
QActionGroup * action_screen;
SFLPhoneView* m_pView ;
QMenu* trayIconMenu ;
bool iconChanged ;
SFLPhoneTray* trayIcon ;
KNotification* notification ;
QLabel* statusBarWidget ;
ContactDock* m_pContactCD ;
QDockWidget* m_pCentralDW ;
HistoryDock* m_pHistoryDW ;
BookmarkDock* m_pBookmarkDW ;
SFLPhoneView* m_pView ;
bool m_pIconChanged ;
SFLPhoneTray* m_pTrayIcon ;
QLabel* m_pStatusBarWidget ;
ContactDock* m_pContactCD ;
QDockWidget* m_pCentralDW ;
HistoryDock* m_pHistoryDW ;
BookmarkDock* m_pBookmarkDW ;
static SFLPhone* m_sApp;
static TreeWidgetCallModel* m_pModel;
......@@ -124,7 +120,6 @@ public:
bool initialize ();
void setupActions ();
void trayIconSignal ();
SFLPhoneView* getView ();
QList<QAction *> getCallActions ();
friend class SFLPhoneView;
......@@ -147,7 +142,7 @@ private slots:
void on_m_pView_recordCheckStateChangeAsked ( bool recordCheckState );
void on_m_pView_screenChanged ( int screen );
void on_m_pView_incomingCall ( const Call * call );
void showShortCutEditor ( );
void updateScreen(QAction * action);
void quitButton();
......
......@@ -26,6 +26,17 @@
#include <QtGui/QBrush>
#include <QtGui/QPalette>
#include <QtGui/QInputDialog>
#include <QtGui/QWidget>
#include <QtCore/QString>
#include <QtGui/QKeyEvent>
#include <QErrorMessage>
#include <KXmlGuiWindow>
#include "conf/ConfigurationDialog.h"
#include "AccountWizard.h"
#include "lib/Contact.h"
#include "lib/AccountList.h"
#include "CallView.h"
#include <klocale.h>
#include <kstandardaction.h>
......@@ -63,7 +74,7 @@ SFLPhoneView::SFLPhoneView(QWidget *parent)
ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
errorWindow = new QErrorMessage(this);
callTreeModel->setTitle("Calls");
callTreeModel->setTitle(i18n("Calls"));
QPalette pal = QPalette(palette());
pal.setColor(QPalette::AlternateBase, Qt::lightGray);
......@@ -86,12 +97,6 @@ SFLPhoneView::~SFLPhoneView()
{
}
void SFLPhoneView::saveState()
{
//ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
//configurationManager.setHistory(callTreeModel->getHistoryCallId());
}
void SFLPhoneView::loadWindow()
{
updateWindowCallState ();
......@@ -109,11 +114,6 @@ QErrorMessage * SFLPhoneView::getErrorWindow()
return errorWindow;
}
// CallView* SFLPhoneView::model()
// {
// return callTreeModel;
// }
void SFLPhoneView::typeString(QString str)
{
CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
......@@ -323,17 +323,6 @@ void SFLPhoneView::updateWindowCallState()
qDebug() << "Window updated.";
}
void SFLPhoneView::alternateColors(QListWidget * listWidget)
{
for(int i = 0 ; i < listWidget->count(); i++) {
QListWidgetItem* item = listWidget->item(i);
QBrush c = (i % 2 == 1) ? palette().base() : palette().alternateBase();
item->setBackground( c );
}
listWidget->setUpdatesEnabled( true );
}
int SFLPhoneView::phoneNumberTypesDisplayed()
{
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
......@@ -420,25 +409,15 @@ void SFLPhoneView::updateVolumeBar()
void SFLPhoneView::updateVolumeControls()
{
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
int display = false;
if(QString(configurationManager.getAudioManager()) == "alsa") {
display = true;
SFLPhone::app()->action_displayVolumeControls->setEnabled(true);
}
else {
SFLPhone::app()->action_displayVolumeControls->setEnabled(false);
}
SFLPhone::app()->action_displayVolumeControls->setChecked(display);
//SFLPhone::app()->action_displayVolumeControls->setChecked(display);
//widget_recVol->setVisible(display);
//widget_sndVol->setVisible(display);
toolButton_recVol->setVisible ( display && ConfigurationSkeleton::displayVolume() );
toolButton_sndVol->setVisible ( display && ConfigurationSkeleton::displayVolume() );
slider_recVol->setVisible ( display && ConfigurationSkeleton::displayVolume() );
slider_sndVol->setVisible ( display && ConfigurationSkeleton::displayVolume() );
toolButton_recVol->setVisible ( SFLPhone::app()->action_displayVolumeControls->isChecked() && ConfigurationSkeleton::displayVolume() );
toolButton_sndVol->setVisible ( SFLPhone::app()->action_displayVolumeControls->isChecked() && ConfigurationSkeleton::displayVolume() );
slider_recVol->setVisible ( SFLPhone::app()->action_displayVolumeControls->isChecked() && ConfigurationSkeleton::displayVolume() );
slider_sndVol->setVisible ( SFLPhone::app()->action_displayVolumeControls->isChecked() && ConfigurationSkeleton::displayVolume() );
}
......
......@@ -17,55 +17,47 @@
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
**************************************************************************/
#ifndef SFLPHONEVIEW_H
#define SFLPHONEVIEW_H
#include <QtGui/QWidget>
#include <QtCore/QString>
#include "ui_SFLPhoneView_base.h"
#include <QtCore/QVector>
#include <QtCore/QList>
#include <QtGui/QKeyEvent>
#include <QErrorMessage>
#include <KXmlGuiWindow>
#include <QtGui/QWidget>
#include "ui_SFLPhoneView_base.h"
#include "conf/ConfigurationDialog.h"
#include "widgets/CallTreeItem.h"
#include "AccountWizard.h"
#include "lib/Contact.h"
#include "lib/AccountList.h"
#include "CallView.h"
//Qt
class QString;
class QKeyEvent;
class QErrorMessage;
class QListWidget;
//SFLPhone
class ConfigurationDialog;
/**
* This is the main view class for sflphone-client-kde. Most of the non-menu,
* non-toolbar, and non-statusbar (e.g., non frame) GUI code should go
* here.
* As the state of the view has effects on the window,
* it emits some signals to ask for changes that the window has
* to treat.
*
* @short Main view
* @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com>
* @version 0.9.6
class AccountWizard;
class CallView;
/**
* This is the main view class for sflphone-client-kde. Most of the non-menu,
* non-toolbar, and non-statusbar (e.g., non frame) GUI code should go
* here.
* As the state of the view has effects on the window,
* it emits some signals to ask for changes that the window has
* to treat.
*
* @short Main view
* @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com>
* @version 0.9.6
*/
class SFLPhoneView : public QWidget, public Ui::SFLPhone_view
{
Q_OBJECT
private:
//static ConfigurationDialog * configDialog;
AccountWizard * wizard;
//List of calls in the window, and past ones.
//Handles both current calls (dialing, ringing...) and history.
//CallList * callList;
QErrorMessage * errorWindow;
//Account used prioritary if defined and registered. If not, the first registered account in accountList is used.
protected:
......@@ -103,19 +95,6 @@ public:
* chosen to be displayed in SFLphone configuration.
*/
int phoneNumberTypesDisplayed();
/**
*
* @return true if the address book is enabled in config
*/
//bool isAddressBookEnabled();
//QVector<Contact *> findContactsInKAddressBook(QString textSearched, bool & full);
/**
* Save the settings to save in the daemon before exit
*/
void saveState();
private slots:
/**
......@@ -174,13 +153,6 @@ private slots:
*/
void editBeforeCall();
/**
* Alternates colors of the list widget with the application's palettes's
* base and alternateBase colors.
* @param listWidget the list widget to which we alternate colors
*/
void alternateColors(QListWidget * listWidget);
/**
* Updates the toolbar's actions' display according to the selected
* item's state.
......@@ -243,11 +215,10 @@ public slots:
void on_widget_dialpad_typed(QString text);
void on_slider_recVol_valueChanged(int value);
void on_slider_sndVol_valueChanged(int value);
void on_toolButton_recVol_clicked(bool checked);
void on_toolButton_sndVol_clicked(bool checked);
void on_slider_recVol_valueChanged ( int value );
void on_slider_sndVol_valueChanged ( int value );
void on_toolButton_recVol_clicked ( bool checked );
void on_toolButton_sndVol_clicked ( bool checked );
void on1_error(MapStringString details);
void on1_incomingCall(Call* call);
......
......@@ -102,10 +102,10 @@ void SFLPhoneApplication::initializePaths()
qDebug() << "KGlobal::dirs" << QString(DATA_INSTALL_DIR);
// Test whether the prefix is correct.
if( KGlobal::dirs()->findResource( "appdata", "icons/hi128-apps-sflphone-client-kde.png" ).isNull() ) {
kWarning() << "SFLPhone could not find resources in the search paths: "
<< KGlobal::dirs()->findDirs( "appdata", QString::null ).join(", ") << endl;
}
// if( KGlobal::dirs()->findResource( "appdata", "icons/hi128-apps-sflphone-client-kde.png" ).isNull() ) {
// kWarning() << "SFLPhone could not find resources in the search paths: "
// << KGlobal::dirs()->findDirs( "appdata", QString::null ).join(", ") << endl;
//}
}
Q_NOREPLY void SFLPhoneApplication::quit2()
......
......@@ -24,6 +24,7 @@
#include "lib/configurationmanager_interface_singleton.h"
#include "SFLPhoneView.h"
#include "../AccountView.h"
#include "lib/sflphone_const.h"