summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/microkde/kiconloader.cpp12
-rw-r--r--noncore/apps/tinykate/mainwindow/tinykate.cpp40
2 files changed, 33 insertions, 19 deletions
diff --git a/noncore/apps/tinykate/libkate/microkde/kiconloader.cpp b/noncore/apps/tinykate/libkate/microkde/kiconloader.cpp
index 83a2cad..c5fe5df 100644
--- a/noncore/apps/tinykate/libkate/microkde/kiconloader.cpp
+++ b/noncore/apps/tinykate/libkate/microkde/kiconloader.cpp
@@ -1,33 +1,33 @@
-#include <qpe/resource.h>
+#include <opie2/oresource.h>
#include "kiconloader.h"
QPixmap KIconLoader::loadIcon( const QString &name, int )
{
- return Resource::loadPixmap( "kate/" + name );
+ return Opie::Core::OResource::loadPixmap( "kate/" + name, Opie::Core::OResource::SmallIcon );
}
QString KIconLoader::iconPath( const QString &, int )
{
return QString::null;
}
QPixmap BarIcon( const QString &name )
{
- return Resource::loadPixmap( "kate/" + name );
+ return Opie::Core::OResource::loadPixmap( "kate/" + name, Opie::Core::OResource::SmallIcon );
}
QPixmap DesktopIcon( const QString &name, int )
{
- return Resource::loadPixmap( "kate/" + name );
+ return Opie::Core::OResource::loadPixmap( "kate/" + name, Opie::Core::OResource::SmallIcon );
}
QPixmap SmallIcon( const QString &name )
{
- return Resource::loadPixmap( "kate/" + name );
+ return Opie::Core::OResource::loadPixmap( "kate/" + name, Opie::Core::OResource::SmallIcon );
}
QPixmap SmallIconSet( const QString &name )
{
- return Resource::loadPixmap( "kate/" + name );
+ return Opie::Core::OResource::loadPixmap( "kate/" + name, Opie::Core::OResource::SmallIcon );
}
diff --git a/noncore/apps/tinykate/mainwindow/tinykate.cpp b/noncore/apps/tinykate/mainwindow/tinykate.cpp
index 8d19c71..bbb0be7e 100644
--- a/noncore/apps/tinykate/mainwindow/tinykate.cpp
+++ b/noncore/apps/tinykate/mainwindow/tinykate.cpp
@@ -1,215 +1,229 @@
/***************************************************************************
tinykate.cpp
Tiny KATE mainwindow
-------------------
begin : November 2002
copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org>
***************************************************************************/
/***************************************************************************
* *
* This program is free softwaSre; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation. *
* ONLY VERSION 2 OF THE LICENSE IS APPLICABLE *
* *
***************************************************************************/
#include "tinykate.h"
#include "katedocument.h"
#include "kglobal.h"
/* OPIE */
#include <opie2/odebug.h>
#include <opie2/ofiledialog.h>
-#include <qpe/resource.h>
+#include <opie2/oresource.h>
#include <qpe/qpeapplication.h>
/* QT */
#include <qaction.h>
#include <qtoolbutton.h>
#include <qmenubar.h>
#include <qmessagebox.h>
using namespace Opie::Ui;
TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
QMainWindow( parent, name, f )
{
shutDown=false;
nextUnnamed=0;
currentView=0;
viewCount=0;
setCaption(tr("TinyKATE"));
KGlobal::setAppName("TinyKATE");
QMenuBar *mb = new QMenuBar( this );
mb->setMargin( 0 );
tabwidget=new OTabWidget(this);
setCentralWidget(tabwidget);
connect(tabwidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(slotCurrentChanged(QWidget*)));
//FILE ACTIONS
QPopupMenu *popup = new QPopupMenu( this );
// Action for creating a new document
- QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
+ QAction *a = new QAction( tr( "New" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
a->addTo( popup );
connect(a, SIGNAL(activated()), this, SLOT(slotNew()));
// Action for opening an exisiting document
- a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 );
+ a = new QAction( tr( "Open" ), Opie::Core::OResource::loadPixmap( "fileopen", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
a->addTo(popup);
connect(a, SIGNAL(activated()), this, SLOT(slotOpen()));
// Action for saving document
- a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 );
+ a = new QAction( tr( "Save" ), Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
a->addTo(popup);
connect(a, SIGNAL(activated()), this, SLOT(slotSave()));
// Action for saving document to a new name
- a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 );
+ a = new QAction( tr( "Save As" ), Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
a->addTo(popup);
connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs()));
// Action for closing the currently active document
- a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 );
+ a = new QAction( tr( "Close" ), Opie::Core::OResource::loadPixmap( "quit_icon", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
a->addTo(popup);
connect(a, SIGNAL(activated()), this, SLOT(slotClose()));
mb->insertItem(tr("File"),popup);
//EDIT ACTIONS
+ bool useBigIcon = qApp->desktop()->size().width() > 330;
// Action for cutting text
editCut = new QToolButton( 0 );
+ editCut->setUsesBigPixmap( useBigIcon );
editCut->setAutoRaise( true );
- editCut->setIconSet( Resource::loadPixmap( "cut" ) );
+ editCut->setIconSet( Opie::Core::OResource::loadPixmap( "cut", Opie::Core::OResource::SmallIcon ) );
// Action for Copying text
editCopy = new QToolButton( 0 );
+ editCopy->setUsesBigPixmap( useBigIcon );
editCopy->setAutoRaise( true );
- editCopy->setIconSet( Resource::loadPixmap( "copy" ) );
+ editCopy->setIconSet( Opie::Core::OResource::loadPixmap( "copy", Opie::Core::OResource::SmallIcon ) );
// Action for pasting text
editPaste = new QToolButton( 0 );
+ editPaste->setUsesBigPixmap( useBigIcon );
editPaste->setAutoRaise( true );
- editPaste->setIconSet( Resource::loadPixmap( "paste" ) );
+ editPaste->setIconSet( Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ) );
// Action for finding / replacing text
editFindReplace = new QToolButton( 0 );
+ editFindReplace->setUsesBigPixmap( useBigIcon );
editFindReplace->setAutoRaise( true );
- editFindReplace->setIconSet( Resource::loadPixmap("find") );
+ editFindReplace->setIconSet( Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ) );
// Action for undo
editUndo = new QToolButton( 0 );
+ editUndo->setUsesBigPixmap( useBigIcon );
editUndo->setAutoRaise( true );
- editUndo->setIconSet( Resource::loadPixmap( "undo" ) );
+ editUndo->setIconSet( Opie::Core::OResource::loadPixmap( "undo", Opie::Core::OResource::SmallIcon ) );
// Action for redo
editRedo = new QToolButton( 0 );
+ editRedo->setUsesBigPixmap( useBigIcon );
editRedo->setAutoRaise( true );
- editRedo->setIconSet( Resource::loadPixmap( "redo" ) );
+ editRedo->setIconSet( Opie::Core::OResource::loadPixmap( "redo", Opie::Core::OResource::SmallIcon ) );
//VIEW ACITONS
popup = new QPopupMenu( this );
viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 );
viewIncFontSizes->addTo( popup );
viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 );
viewDecFontSizes->addTo( popup );
mb->insertItem(tr("View"),popup);
popup = new QPopupMenu( this );
mb->insertItem(tr("Utils"),popup);
mb->insertItem( editCut );
mb->insertItem( editCopy );
mb->insertItem( editPaste );
mb->insertItem( editFindReplace );
mb->insertItem( editUndo );
mb->insertItem( editRedo );
//Highlight management
hlmenu=new QPopupMenu(this);
HlManager *hlm=HlManager::self();
for (int i=0;i<hlm->highlights();i++)
{
hlmenu->insertItem(hlm->hlName(i),i);
}
popup->insertItem(tr("Highlighting"),hlmenu);
- utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 );
+ utilSettings = new QAction( tr( "Settings" ),
+ Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
utilSettings->addTo( popup);
if( qApp->argc() > 1) open(qApp->argv()[1]);
else slotNew();
}
TinyKate::~TinyKate( )
{
owarn << "TinyKate destructor\n" << oendl;
shutDown=true;
while (currentView!=0)
{
slotClose();
}
if( KGlobal::config() != 0 )
{
owarn << "deleting KateConfig object..\n" << oendl;
delete KGlobal::config();
}
}
void TinyKate::slotOpen( )
{
QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
QString::null);
if (!filename.isEmpty())
{
open(filename);
}
}
void TinyKate::open(const QString & filename)
{
KateDocument *kd= new KateDocument(false, false, this,0,this);
KTextEditor::View *kv;
QString realFileName;
//check if filename is a .desktop file
if ( filename.find( ".desktop", 0, true ) )
{
switch ( QMessageBox::warning( this, tr( "TinyKATE" ),
tr("TinyKATE has detected<BR>you selected a <B>.desktop</B> file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?" ),
tr(".desktop File"),
tr("Linked Document"), 0, 1, 1 ) )
{
case 0: //desktop
realFileName = filename;
break;
case 1: //linked
DocLnk docLnk( filename );
realFileName = docLnk.file();
break;
};
}
QFileInfo fileInfo( realFileName );
QString filenamed = fileInfo.fileName();
tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed );
odebug << realFileName << oendl;
kd->setDocName( filenamed);
kd->open( realFileName );