summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt8
-rw-r--r--bin/kdepim/kaddressbook/icons16/z_menu.pngbin0 -> 713 bytes
-rw-r--r--bin/kdepim/kaddressbook/icons22/z_menu.pngbin0 -> 1017 bytes
-rw-r--r--bin/kdepim/korganizer/icons16/z_menu.pngbin0 -> 713 bytes
-rw-r--r--bin/kdepim/korganizer/iconsmini/z_menu.pngbin0 -> 572 bytes
-rw-r--r--bin/kdepim/korganizer/z_menu.pngbin0 -> 1017 bytes
-rw-r--r--kaddressbook/kabcore.cpp2
-rw-r--r--korganizer/kotodoviewitem.cpp7
-rw-r--r--korganizer/mainwindow.cpp29
-rw-r--r--pwmanager/pwmanager/listviewpwm.cpp8
-rw-r--r--pwmanager/pwmanager/listviewpwm.h2
-rw-r--r--pwmanager/pwmanager/pwmview.cpp2
-rw-r--r--pwmanager/pwmanager/pwmviewstyle.cpp4
-rw-r--r--pwmanager/pwmanager/pwmviewstyle.h2
14 files changed, 48 insertions, 16 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 657d1de..7438f9d 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,50 +1,58 @@
Info about the changes in new versions of KDE-Pim/Pi
+********** VERSION 2.0.15 ************
+
+PwM/Pi:
+Added keyboard shorcuts for
+- toggling summary view (space bar)
+- delete item (delete + backspace key)
+- add new item ( i + n key)
+
********** VERSION 2.0.14 ************
Made Passwordmanager PwM/Pi more userfriendly:
Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more.
Fixed bug in KO/Pi todo printing.
Made Qtopia calendar import possible on desktop .
********** VERSION 2.0.13 ************
Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter.
In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down".
OM/Pi:
Fixed a refresh problem of outgoing/sent/sendfailed folders after sending mails.
Added missing German translation.
Added warning if path is specified in local folder settings of account config.
********** VERSION 2.0.12 ************
KO/Pi:
Fixed a bug in todo start/due date handling for non recurring todos with a start and due date.
Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes.
Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer.
Fixed problem in pi-sync mode when wrong password was sent.
OM/Pi:
Fixed a crash when displaying mails with "Show mail as html" was checked in the config.
Added a check before displaying the mail if the mail is in html format, if "Show mail as html" is enabled.
********** VERSION 2.0.11 ************
Fixed some problems in pi-sync mode
(e.g. details of events were not synced properly)
********** VERSION 2.0.10 ************
KO/Pi:
In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view.
This is fixed.
Changed the search dialog a bit to make it more user friendly.
(E.g.: Removed message box about "no items found" and set key focus to search line edit after search).
Added config option to hide the week number in KO/Pi toolbar.
********** VERSION 2.0.9 ************
diff --git a/bin/kdepim/kaddressbook/icons16/z_menu.png b/bin/kdepim/kaddressbook/icons16/z_menu.png
new file mode 100644
index 0000000..b32c8e5
--- a/dev/null
+++ b/bin/kdepim/kaddressbook/icons16/z_menu.png
Binary files differ
diff --git a/bin/kdepim/kaddressbook/icons22/z_menu.png b/bin/kdepim/kaddressbook/icons22/z_menu.png
new file mode 100644
index 0000000..b1866a2
--- a/dev/null
+++ b/bin/kdepim/kaddressbook/icons22/z_menu.png
Binary files differ
diff --git a/bin/kdepim/korganizer/icons16/z_menu.png b/bin/kdepim/korganizer/icons16/z_menu.png
new file mode 100644
index 0000000..b32c8e5
--- a/dev/null
+++ b/bin/kdepim/korganizer/icons16/z_menu.png
Binary files differ
diff --git a/bin/kdepim/korganizer/iconsmini/z_menu.png b/bin/kdepim/korganizer/iconsmini/z_menu.png
new file mode 100644
index 0000000..584791a
--- a/dev/null
+++ b/bin/kdepim/korganizer/iconsmini/z_menu.png
Binary files differ
diff --git a/bin/kdepim/korganizer/z_menu.png b/bin/kdepim/korganizer/z_menu.png
new file mode 100644
index 0000000..b1866a2
--- a/dev/null
+++ b/bin/kdepim/korganizer/z_menu.png
Binary files differ
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 1b17665..79f897b 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2083,97 +2083,97 @@ void KABCore::initActions()
mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
this, SLOT( createAboutData() ), actionCollection(),
"kaddressbook_about_data" );
#endif //KAB_EMBEDDED
clipboardDataChanged();
connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
}
//US we need this function, to plug all actions into the correct menues.
// KDE uses a XML format to plug the actions, but we work her without this overhead.
void KABCore::addActionsManually()
{
//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
#ifdef KAB_EMBEDDED
QPopupMenu *fileMenu = new QPopupMenu( this );
QPopupMenu *editMenu = new QPopupMenu( this );
QPopupMenu *helpMenu = new QPopupMenu( this );
KToolBar* tb = mMainWindow->toolBar();
#ifndef DESKTOP_VERSION
if ( KABPrefs::instance()->mFullMenuBarVisible ) {
#endif
QMenuBar* mb = mMainWindow->menuBar();
//US setup menubar.
//Disable the following block if you do not want to have a menubar.
mb->insertItem( i18n("&File"), fileMenu );
mb->insertItem( i18n("&Edit"), editMenu );
mb->insertItem( i18n("&View"), viewMenu );
mb->insertItem( i18n("&Settings"), settingsMenu );
#ifdef DESKTOP_VERSION
mb->insertItem( i18n("Synchronize"), syncMenu );
#else
mb->insertItem( i18n("Sync"), syncMenu );
#endif
//mb->insertItem( i18n("&Change"), changeMenu );
mb->insertItem( i18n("&Help"), helpMenu );
mIncSearchWidget = new IncSearchWidget( tb );
// tb->insertWidget(-1, 0, mIncSearchWidget);
#ifndef DESKTOP_VERSION
} else {
//US setup toolbar
QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
QPopupMenu *popupBarTB = new QPopupMenu( this );
- menuBarTB->insertItem( "ME", popupBarTB);
+ menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB);
tb->insertWidget(-1, 0, menuBarTB);
mIncSearchWidget = new IncSearchWidget( tb );
tb->enableMoving(false);
popupBarTB->insertItem( i18n("&File"), fileMenu );
popupBarTB->insertItem( i18n("&Edit"), editMenu );
popupBarTB->insertItem( i18n("&View"), viewMenu );
popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
mViewManager->getFilterAction()->plug ( popupBarTB);
//popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
popupBarTB->insertItem( i18n("&Help"), helpMenu );
if (QApplication::desktop()->width() > 320 ) {
// mViewManager->getFilterAction()->plug ( tb);
}
}
#endif
// mActionQuit->plug ( mMainWindow->toolBar());
//US Now connect the actions with the menue entries.
#ifdef DESKTOP_VERSION
mActionPrint->plug( fileMenu );
mActionPrintDetails->plug( fileMenu );
fileMenu->insertSeparator();
#endif
mActionMail->plug( fileMenu );
fileMenu->insertSeparator();
mActionNewContact->plug( fileMenu );
mActionNewContact->plug( tb );
mActionEditAddressee->plug( fileMenu );
// if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
// (!KABPrefs::instance()->mMultipleViewsAtOnce ))
mActionEditAddressee->plug( tb );
fileMenu->insertSeparator();
mActionSave->plug( fileMenu );
fileMenu->insertItem( "&Import", ImportMenu );
fileMenu->insertItem( "&Export", ExportMenu );
fileMenu->insertItem( i18n("&Change"), changeMenu );
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu );
#endif
#if 0
// PENDING fix MailVCard
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 70f00c6..6559119 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -319,98 +319,101 @@ bool KOTodoViewItem::isAlternate()
{
KOTodoViewItem *item;
bool previous = true;
if (QListViewItem::parent())
{
item = static_cast<KOTodoViewItem *>(QListViewItem::parent());
if (item)
previous = item->m_odd;
item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild());
}
else
{
item = static_cast<KOTodoViewItem *>(lv->firstChild());
}
while(item)
{
item->m_odd = previous = !previous;
item->m_known = true;
item = static_cast<KOTodoViewItem *>(item->nextSibling());
}
}
return m_odd;
}
return false;
}
void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
{
QColorGroup _cg = cg;
QColorGroup::ColorRole role;
if ( KOPrefs::instance()->mTodoViewUsesForegroundColor )
role = QColorGroup::Text;
else
role = QColorGroup::Base;
//#ifndef KORG_NOLVALTERNATION
if (isAlternate())
_cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground());
bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors;
QColor colorToSet;
if ( setColor ) {
QStringList categories = mTodo->categories();
QString cat = categories.first();
if ( !cat.isEmpty()) {
colorToSet = *(KOPrefs::instance()->categoryColor(cat) );
} else
setColor = false;
}
-
- int odue = mTodo->hasDueSubTodo( !isOpen());
+ bool openMode = !isOpen();
+ // maybe we are in flat-display-mode
+ if ( !firstChild() )
+ openMode = false;
+ int odue = mTodo->hasDueSubTodo( openMode );
if (odue == 2) {
colorToSet = KOPrefs::instance()->mTodoOverdueColor;
setColor = true;
} else if ( odue == 1 ) {
colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
setColor = true;
}
if ( setColor ) {
_cg.setColor(role,colorToSet );
if ( role == QColorGroup::Base) {
int rgb = colorToSet.red();
rgb += colorToSet.blue()/2;
rgb += colorToSet.green();
if ( rgb < 200 )
_cg.setColor(QColorGroup::Text,Qt::white );
}
}
//#endif
if ( column > 0 ){
if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) {
p->save();
int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5);
p->fillRect( 0, 0, width, height(), _cg.base() ); // background
// p->setPen(Qt::black ); //border
// p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling
QColor fc = KOPrefs::instance()->mHighlightColor;
if ( mTodo->percentComplete() == 100 )
fc = darkGreen;
p->drawRect( 2, 2, width-4, height()-4);
p->fillRect( 3, 3, progress, height()-6,
fc );
p->restore();
} else {
QCheckListItem::paintCell(p, _cg, column, width, alignment);
}
return;
}
int align = alignment;
if ( !p )
return;
p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) );
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 006a8dd..019f41f 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -474,142 +474,145 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
mView->viewManager()->showWeekView();
}
else if ( msg == "-showTodo" ) {
mView->viewManager()->showTodoView();
}
else if ( msg == "-showJournal" ) {
mView->dateNavigator()->selectDates( 1 );
mView->dateNavigator()->selectToday();
mView->viewManager()->showJournalView();
}
else if ( msg == "-showKO" ) {
mView->viewManager()->showNextXView();
}
else if ( msg == "-showWNext" || msg == "nextView()" ) {
mView->viewManager()->showWhatsNextView();
}
else if ( msg == "-showNextXView" ) {
mView->viewManager()->showNextXView();
}
}
showMaximized();
raise();
}
QPixmap MainWindow::loadPixmap( QString name )
{
return SmallIcon( name );
}
void MainWindow::initActions()
{
//KOPrefs::instance()->mShowFullMenu
iconToolBar->clear();
KOPrefs *p = KOPrefs::instance();
//QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
QPopupMenu *viewMenu = new QPopupMenu( this );
QPopupMenu *actionMenu = new QPopupMenu( this );
QPopupMenu *importMenu = new QPopupMenu( this );
selectFilterMenu = new QPopupMenu( this );
selectFilterMenu->setCheckable( true );
syncMenu = new QPopupMenu( this );
configureAgendaMenu = new QPopupMenu( this );
configureToolBarMenu = new QPopupMenu( this );
QPopupMenu *helpMenu = new QPopupMenu( this );
+
+ QIconSet icon;
+ int pixWid = 22, pixHei = 22;
+ QString pathString = "";
+ if ( !p->mToolBarMiniIcons ) {
+ if ( QApplication::desktop()->width() < 480 ) {
+ pathString += "icons16/";
+ pixWid = 18; pixHei = 16;
+ }
+ } else {
+ pathString += "iconsmini/";
+ pixWid = 18; pixHei = 16;
+ }
if ( KOPrefs::instance()->mShowFullMenu ) {
QMenuBar *menuBar1;
menuBar1 = menuBar();
menuBar1->insertItem( i18n("File"), importMenu );
menuBar1->insertItem( i18n("View"), viewMenu );
menuBar1->insertItem( i18n("Actions"), actionMenu );
#ifdef DESKTOP_VERSION
menuBar1->insertItem( i18n("Synchronize"), syncMenu );
menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
#else
menuBar1->insertItem( i18n("Sync"), syncMenu );
menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
#endif
//menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
menuBar1->insertItem( i18n("Help"), helpMenu );
} else {
QPEMenuBar *menuBar1;
menuBar1 = new QPEMenuBar( iconToolBar );
QPopupMenu *menuBar = new QPopupMenu( this );
- menuBar1->insertItem( i18n("ME"), menuBar);
+ icon = loadPixmap( pathString + "z_menu" );
+ menuBar1->insertItem( icon.pixmap(), menuBar);
+ //menuBar1->insertItem( i18n("ME"), menuBar);
menuBar->insertItem( i18n("File"), importMenu );
menuBar->insertItem( i18n("View"), viewMenu );
menuBar->insertItem( i18n("Actions"), actionMenu );
menuBar->insertItem( i18n("Synchronize"), syncMenu );
menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
menuBar->insertItem( i18n("Filter"),selectFilterMenu );
menuBar->insertItem( i18n("Help"), helpMenu );
//menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
menuBar1->setMaximumSize( menuBar1->sizeHint( ));
}
connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
- QIconSet icon;
- int pixWid = 22, pixHei = 22;
- QString pathString = "";
- if ( !p->mToolBarMiniIcons ) {
- if ( QApplication::desktop()->width() < 480 ) {
- pathString += "icons16/";
- pixWid = 18; pixHei = 16;
- }
- } else {
- pathString += "iconsmini/";
- pixWid = 18; pixHei = 16;
- }
mWeekBgColor = iconToolBar->backgroundColor();
mWeekPixmap.resize( pixWid , pixHei );
mWeekPixmap.fill( mWeekBgColor );
icon = mWeekPixmap;
mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
if ( p-> mShowIconWeekNum )
mWeekAction->addTo( iconToolBar );
mWeekFont = font();
int fontPoint = mWeekFont.pointSize();
QFontMetrics f( mWeekFont );
int fontWid = f.width( "30" );
while ( fontWid > pixWid ) {
--fontPoint;
mWeekFont.setPointSize( fontPoint );
QFontMetrics f( mWeekFont );
fontWid = f.width( "30" );
qDebug("dec-- ");
}
connect( mWeekAction, SIGNAL( activated() ),
this, SLOT( weekAction() ) );
connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
//#endif
// ******************
QAction *action;
// QPopupMenu *configureMenu= new QPopupMenu( menuBar );
configureToolBarMenu->setCheckable( true );
configureAgendaMenu->setCheckable( true );
int iii ;
for ( iii = 1;iii<= 10 ;++iii ){
configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
}
//configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
connect( configureAgendaMenu, SIGNAL( aboutToShow()),
this, SLOT( showConfigureAgenda( ) ) );
icon = loadPixmap( pathString + "configure" );
action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
action->addTo( actionMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( edit_options() ) );
actionMenu->insertSeparator();
diff --git a/pwmanager/pwmanager/listviewpwm.cpp b/pwmanager/pwmanager/listviewpwm.cpp
index 8d46fff..0df9431 100644
--- a/pwmanager/pwmanager/listviewpwm.cpp
+++ b/pwmanager/pwmanager/listviewpwm.cpp
@@ -2,96 +2,104 @@
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "listviewpwm.h"
#include "pwmexception.h"
#include "pwmview.h"
#include <qpainter.h>
#include <qpixmap.h>
#include <kiconloader.h>
#ifdef PWM_EMBEDDED
#include <kglobal.h>
#endif
ListViewPwM::ListViewPwM(QWidget *parent, const char *name)
: KListView(parent, name)
{
// setResizeMode(QListView::AllColumns);
setAllColumnsShowFocus (true );
}
bool ListViewPwM::event(QEvent *e)
{
if (e->type() == QEvent::LayoutHint)
emit layoutChanged();
if (e->type() == QEvent::KeyPress) {
QKeyEvent* ke = (QKeyEvent*) e;
if ( ke->key() == Qt::Key_Space) {
emit toggleOverview();
return true;
}
+ if ( ke->key() == Qt::Key_I || ke->key() == Qt::Key_N || ke->key() == Qt::Key_Insert) {
+ emit insertPW();
+ return true;
+ }
+ if ( ke->key() == Qt::Key_Delete || ke->key() == Qt::Key_Backspace) {
+ emit deletePW();
+ return true;
+ }
}
return KListView::event(e);
}
QPixmap * ListViewItemPwM::onPix = 0;
QPixmap * ListViewItemPwM::offPix = 0;
ListViewItemPwM::ListViewItemPwM(QListView *parent)
: QCheckListItem(parent, "", QCheckListItem::CheckBox)
{
if (!onPix) {
PWM_ASSERT(!offPix);
KIconLoader* picons;
#ifndef PWM_EMBEDDED
KIconLoader il;
picons = &il;
#else
picons = KGlobal::iconLoader();
#endif
KIconLoader il;
#ifndef PWM_EMBEDDED
static QPixmap onP(picons->loadIcon("button_ok", KIcon::Small));
#else
static QPixmap onP(picons->loadIcon("decrypted", KIcon::Small));
#endif
onPix = &onP;
static QPixmap offP(picons->loadIcon("encrypted", KIcon::Small));
offPix = &offP;
}
}
void ListViewItemPwM::paintCell(QPainter *p, const QColorGroup &cg,
int column, int width, int align)
{
// qDebug("ListViewItemPwM::paintCell column=%i", column);
if (!p)
return;
//US BUG:
if (column != COLUMN_DESC) {
QCheckListItem::paintCell(p, cg, column, width, align);
return;
}
QPixmap *curPix = isOn() ? onPix : offPix;
int pixSpace = curPix->width();
pixSpace += 4;
diff --git a/pwmanager/pwmanager/listviewpwm.h b/pwmanager/pwmanager/listviewpwm.h
index 840ee73..51008b8 100644
--- a/pwmanager/pwmanager/listviewpwm.h
+++ b/pwmanager/pwmanager/listviewpwm.h
@@ -1,58 +1,60 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef __LISTVIEW_H
#define __LISTVIEW_H
#include <klistview.h>
/** PwManager implementation of the list view.
* Derived from KListView.
*/
class ListViewPwM : public KListView
{
Q_OBJECT
public:
ListViewPwM(QWidget *parent = 0, const char *name = 0);
signals:
void layoutChanged();
void toggleOverview();
+ void insertPW();
+ void deletePW( );
protected:
virtual bool event(QEvent *e);
};
class ListViewItemPwM : public QCheckListItem
{
public:
ListViewItemPwM(QListView *parent);
protected:
void paintCell(QPainter *p, const QColorGroup &cg,
int column, int width, int align);
protected:
/** pixmap to display for an item with state "on" */
static QPixmap *onPix;
/** pixmap to display for an item with state "off" */
static QPixmap *offPix;
};
#endif
diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp
index 0092692..2533487 100644
--- a/pwmanager/pwmanager/pwmview.cpp
+++ b/pwmanager/pwmanager/pwmview.cpp
@@ -21,96 +21,98 @@
#include "pwmexception.h"
#include "globalstuff.h"
#include "pwm.h"
#include "rencatwnd.h"
#ifndef PWM_EMBEDDED
#include "configuration.h"
#else
#include "pwmprefs.h"
#endif
#include "commentbox.h"
#include <kmessagebox.h>
#include <klocale.h>
#include <qlineedit.h>
#include <qpoint.h>
#include <qapplication.h>
#include <qlayout.h>
//US ENH: wouldn't it be a good idea if we could use this consts everywhere else.
//US ENH: for examle in listviewpwm.cpp
//US ENH: Because of that I transfer them into the headerfile.
/*
#define COLUMN_DESC 0
#define COLUMN_NAME 1
#define COLUMN_PW 2
#define COLUMN_URL 3
#define COLUMN_LAUNCHER 4
*/
PwMView::PwMView(PwM *_mainClass,
QWidget *parent, PwMDoc *_doc,
const char *name)
: PwMViewStyle(parent, name)
{
PWM_ASSERT(_mainClass);
PWM_ASSERT(parent);
PWM_ASSERT(_doc);
setView(this);
doc = _doc;
doc->setListViewPointer(this);
mainClass = _mainClass;
resize(_mainClass->size());
initStyle(conf()->confWndMainViewStyle());
initCtxMenu();
doc->setCurrentView(this);
connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView()));
connect(this, SIGNAL(editPW()), mainClass, SLOT(editPwd_slot()));
+ connect(this, SIGNAL(insertPW()), mainClass, SLOT(addPwd_slot()));
+ connect(this, SIGNAL(deletePW()), mainClass, SLOT(deletePwd_slot()));
}
PwMView::~PwMView()
{
}
void PwMView::initCtxMenu()
{
ctxMenu = new QPopupMenu(this);
ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot()));
ctxMenu->insertSeparator();
ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot()));
ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot()));
ctxMenu->insertSeparator();
ctxMenu->insertItem(i18n("copy password to clipboard"),
this, SLOT(copyPwToClip()));
ctxMenu->insertItem(i18n("copy username to clipboard"),
this, SLOT(copyNameToClip()));
ctxMenu->insertItem(i18n("copy description to clipboard"),
this, SLOT(copyDescToClip()));
ctxMenu->insertItem(i18n("copy url to clipboard"),
this, SLOT(copyUrlToClip()));
ctxMenu->insertItem(i18n("copy launcher to clipboard"),
this, SLOT(copyLauncherToClip()));
ctxMenu->insertItem(i18n("copy comment to clipboard"),
this, SLOT(copyCommentToClip()));
ctxMenu->insertSeparator();
ctxMenu->insertItem(i18n("Execute \"Launcher\""), mainClass,
SLOT(execLauncher_slot()));
ctxMenu->insertItem(i18n("Go to \"URL\""), mainClass,
SLOT(goToURL_slot()));
}
void PwMView::resizeEvent(QResizeEvent *)
{
resizeView(size());
}
void PwMView::refreshCommentTextEdit(QListViewItem *curItem)
{
PWM_ASSERT(commentBox);
if (!curItem)
return;
string comment;
PwMerror ret;
ret = document()->getCommentByLvp_long(getCurrentCategory(),
lv->childCount() - lv->itemIndex(curItem) - 1,
&comment);
diff --git a/pwmanager/pwmanager/pwmviewstyle.cpp b/pwmanager/pwmanager/pwmviewstyle.cpp
index 5f25880..ee35472 100644
--- a/pwmanager/pwmanager/pwmviewstyle.cpp
+++ b/pwmanager/pwmanager/pwmviewstyle.cpp
@@ -58,96 +58,100 @@ PwMViewStyle::~PwMViewStyle()
PWMPrefs::instance()->writeConfig();
delete_ifnot_null(s0);
delete_ifnot_null(s1);
}
void PwMViewStyle::editPassWord( QListViewItem * i )
{
if ( !i )
return;
emit editPW();
}
void PwMViewStyle::initStyle(style_t style)
{
printDebug(string("initializing style ") + tostr(style));
bool wasMaximized = v->isMaximized();
if (v->isVisible())
v->hide();
switch (style) {
case style_0:
delete_ifnot_null(s0);
delete_ifnot_null(s1);
s0 = new PwMViewStyle_0(v);
lv = s0->getLv();
commentBox = s0->getCommentBox();
break;
case style_1:
delete_ifnot_null(s0);
delete_ifnot_null(s1);
s1 = new PwMViewStyle_1(v);
lv = s1->getLv();
commentBox = s1->getCommentBox();
break;
default:
BUG();
return;
}
curStyle = style;
connect(lv, SIGNAL(pressed(QListViewItem *)),
v, SLOT(handleToggle(QListViewItem *)));
connect(lv, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)),
v, SLOT(handleRightClick(QListViewItem *, const QPoint &, int)));
connect(lv, SIGNAL(clicked(QListViewItem *)),
v, SLOT(refreshCommentTextEdit(QListViewItem *)));
connect(lv, SIGNAL(returnPressed(QListViewItem *)),
this, SLOT(editPassWord(QListViewItem *)));
connect(lv, SIGNAL(doubleClicked(QListViewItem *)),
this, SLOT(editPassWord(QListViewItem *)));
+ connect(lv, SIGNAL(insertPW()),
+ this, SIGNAL( insertPW() ));
+ connect(lv, SIGNAL(deletePW()),
+ this, SIGNAL( deletePW() ));
lv->addColumn(i18n("Description"), 180);
lv->addColumn(i18n("Username"), 150);
lv->addColumn(i18n("Password"), 150);
lv->addColumn(i18n("URL"), 180);
lv->addColumn(i18n("Launcher"), 120);
v->tmpReEnableSort();
//US ENH : load the size of the listviewcolumns
switch (curStyle)
{
case style_0:
s0->restoreSettings(PWMPrefs::instance());
break;
case style_1:
s1->restoreSettings(PWMPrefs::instance());
break;
default:
BUG();
}
resizeView(v->size());
v->updateView();
if (wasMaximized) {
v->showMaximized();
} else {
v->show();
}
connect(lv, SIGNAL(layoutChanged()),
v, SLOT(reorgLp()));
}
void PwMViewStyle::resizeView(const QSize &size)
{
switch (curStyle) {
case style_0:
PWM_ASSERT(s0);
s0->resize(size);
return;
case style_1:
PWM_ASSERT(s1);
s1->resize(size);
return;
default:
BUG();
}
}
diff --git a/pwmanager/pwmanager/pwmviewstyle.h b/pwmanager/pwmanager/pwmviewstyle.h
index 5656cbc..6c2d81c 100644
--- a/pwmanager/pwmanager/pwmviewstyle.h
+++ b/pwmanager/pwmanager/pwmviewstyle.h
@@ -63,51 +63,53 @@ public:
/** initialize a new style */
void initStyle(style_t style);
void initStyle(int style)
{ initStyle(static_cast<style_t>(style)); }
/** returns the currently used style */
style_t getCurStyle()
{ return curStyle; }
void setView(PwMView *view)
{ v = view; }
/** returns the currently selected category */
QString getCurrentCategory();
protected:
/** add Category to the view */
void addCategory(const QString &cat);
/** delete Category from view */
void delCategory(const QString &cat);
/** delete all categories from view */
void delAllCategories();
/** select the specified category */
void selectCategory(const QString &cat);
/** returns the number of categories in this view.
* This value dosn't say anything about the number of
* categories in the document.
*/
int numCategories();
/** resize the view */
void resizeView(const QSize &size);
ListViewPwM *lv;
CommentBox *commentBox;
protected slots:
void editPassWord( QListViewItem * );
private:
/** which style has the view?
* KListBox on the left,
* or QComboBox on the top?
*/
style_t curStyle;
PwMViewStyle_0 *s0;
PwMViewStyle_1 *s1;
PwMView *v;
signals:
void editPW();
+ void insertPW();
+ void deletePW();
};
#endif