⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dirhistorybutton.cpp

📁 LINUX 下, 以 QT/KDE 写的档案管理员
💻 CPP
字号:
/***************************************************************************                         dirhistorybutton.cpp  -  description                            -------------------   begin                : Sun Jan 4 2004   copyright            : (C) 2004 by Shie Erlich & Rafi Yanai   email                : ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/#include "dirhistorybutton.h"#include "dirhistoryqueue.h"#include "../VFS/vfs.h"#include <qpopupmenu.h>#include <qdir.h>#include <klocale.h>#include <kiconloader.h>#include <kdebug.h>DirHistoryButton::DirHistoryButton( DirHistoryQueue* hQ, QWidget *parent, const char *name ) : QToolButton( parent, name ) {	KIconLoader * iconLoader = new KIconLoader();	QPixmap icon = iconLoader->loadIcon( "history", KIcon::Toolbar, 16 );	setFixedSize( icon.width() + 4, icon.height() + 4 );	setPixmap( icon );	setTextLabel( i18n( "Open the directory history list" ), true );	setPopupDelay( 10 ); // 0.01 seconds press	setAcceptDrops( false );	popupMenu = new QPopupMenu( this );	Q_CHECK_PTR( popupMenu );	setPopup( popupMenu );	popupMenu->setCheckable( true );	historyQueue = hQ;	connect( popupMenu, SIGNAL( aboutToShow() ), this, SLOT( slotAboutToShow() ) );	connect( popupMenu, SIGNAL( activated( int ) ), this, SLOT( slotPopupActivated( int ) ) );}DirHistoryButton::~DirHistoryButton() {}void DirHistoryButton::openPopup() {	QPopupMenu * pP = popup();	if ( pP ) {		popup() ->exec( mapToGlobal( QPoint( 0, height() ) ) );	}}/** No descriptions */void DirHistoryButton::slotPopup() {	//  kdDebug() << "History slot" << endl;}/** No descriptions */void DirHistoryButton::slotAboutToShow() {	//  kdDebug() << "about to show" << endl;	popupMenu->clear();	KURL::List::iterator it;	int id = 0;	for ( it = historyQueue->urlQueue.begin(); it != historyQueue->urlQueue.end(); ++it ) {		popupMenu->insertItem( (*it).prettyURL(), id++ );	}	if ( id > 0 ) {		popupMenu->setItemChecked( 0, true );	}}/** No descriptions */void DirHistoryButton::slotPopupActivated( int id ) {	emit openUrl( historyQueue->urlQueue[ id ] );}#include "dirhistorybutton.moc"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -