summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-06 22:38:50 (UTC)
committer llornkcor <llornkcor>2002-04-06 22:38:50 (UTC)
commit08f0cefd22cb2122850b0786dafae15d0a5efebb (patch) (side-by-side diff)
tree9b3b576e557b92e9cb60f97d6a20875968910f1b
parent6c651fd3b48421fe2fb0f76968c29ef142efc162 (diff)
downloadopie-08f0cefd22cb2122850b0786dafae15d0a5efebb.zip
opie-08f0cefd22cb2122850b0786dafae15d0a5efebb.tar.gz
opie-08f0cefd22cb2122850b0786dafae15d0a5efebb.tar.bz2
translation stuff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp26
-rw-r--r--core/apps/textedit/filePermissions.cpp12
-rw-r--r--core/apps/textedit/fileSaver.cpp6
-rw-r--r--core/apps/textedit/fontDialog.cpp2
-rw-r--r--core/apps/textedit/textedit.cpp18
5 files changed, 32 insertions, 32 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp
index b655c96..bc99348 100644
--- a/core/apps/textedit/fileBrowser.cpp
+++ b/core/apps/textedit/fileBrowser.cpp
@@ -27,49 +27,49 @@
#include <qlistview.h>
#include <qcombo.h>
#include <qpushbutton.h>
#include <qfile.h>
#include <qmessagebox.h>
#include <qlayout.h>
#include <unistd.h>
#include <qpopupmenu.h>
#include <qlineedit.h>
#include <qstringlist.h>
#include <unistd.h>
#include <stdlib.h>
static int u_id = 1;
static int get_unique_id()
{
return u_id++;
}
fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString mimeFilter )
: QDialog( parent, name, modal, fl )
{
if ( !name )
- setName( "fileBrowser" );
+ setName( tr("fileBrowser") );
setCaption(tr( name ) );
// mimeType = mimeFilter;
// MimeType mt( mimeType);
// if( mt.extension().isEmpty())
// QStringList filterList;
// filterList=QStringList::split(";",mimeFilter,FALSE);
// for ( QStringList::Iterator it = filterList.begin(); it != filterList.end(); ++it ) {
// printf( "%s \n", (*it).latin1() );
// }
filterStr = mimeFilter.right(mimeFilter.length() - mimeFilter.find("/",0,TRUE) - 1);// "*";
qDebug(filterStr);
// else
// filterStr = "*."+ mt.extension();
// qDebug("description "+mt.description());
// qDebug( "id "+mt.id());
// qDebug("extension "+mt.extension());
// channel = new QCopChannel( "QPE/fileDialog", this );
// connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
// this, SLOT(receive(const QCString&, const QByteArray&)) );
QGridLayout *layout = new QGridLayout( this );
@@ -99,49 +99,49 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags
docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
docButton->setMinimumSize( QSize( 20, 20 ) );
docButton->setMaximumSize( QSize( 20, 20 ) );
connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
docButton->setFlat(TRUE);
layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
homeButton->setMinimumSize( QSize( 20, 20 ) );
homeButton->setMaximumSize( QSize( 20, 20 ) );
connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
homeButton->setFlat(TRUE);
layout->addMultiCellWidget( homeButton, 0, 0, 7, 7 );
FileStack = new QWidgetStack( this );
ListView = new QListView( this, "ListView" );
// ListView->setMinimumSize( QSize( 100, 25 ) );
ListView->addColumn( tr( "Name" ) );
ListView->setColumnWidth(0,120);
ListView->setSorting( 2, FALSE);
ListView->addColumn( tr( "Size" ) );
ListView->setColumnWidth(1,-1);
- ListView->addColumn( "Date",-1);
+ ListView->addColumn( tr("Date"),-1);
ListView->setColumnWidthMode(0,QListView::Manual);
ListView->setColumnAlignment(1,QListView::AlignRight);
ListView->setColumnAlignment(2,QListView::AlignRight);
ListView->setAllColumnsShowFocus( TRUE );
QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold);
connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
FileStack->addWidget( ListView, get_unique_id() );
fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy
// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) );
// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ),
this, SLOT( docOpen( const DocLnk & ) ) );
layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 );
SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" );
SelectionCombo->insertItem( tr( "Documents" ) );
SelectionCombo->insertItem( tr( "All files" ) );
@@ -327,56 +327,56 @@ void fileBrowser::OnOK()
}
}
accept();
}
void fileBrowser::homeButtonPushed() {
QString current = QDir::homeDirPath();
chdir( current.latin1() );
currentDir.cd( current, TRUE);
populateList();
update();
}
void fileBrowser::docButtonPushed() {
QString current = QPEApplication::documentDir();
chdir( current.latin1() );
currentDir.cd( current, TRUE);
populateList();
update();
}
void fileBrowser::selectionChanged( const QString &select )
{
- if ( select == "Documents") {
+ if ( select == tr("Documents")) {
FileStack->raiseWidget( fileSelector );
dirPathCombo->hide();
cdUpButton->hide();
docButton->hide();
homeButton->hide();
} else {
- if ( select == "All files" )
+ if ( select == tr("All files") )
currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::All);
else
currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
populateList();
update();
dirPathCombo->show();
cdUpButton->show();
docButton->show();
homeButton->show();
FileStack->raiseWidget( ListView );
}
}
void fileBrowser::docOpen( const DocLnk &doc )
{
fileList.append( doc.file().latin1() );
accept();
}
void fileBrowser::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
{
switch (mouse) {
case 1:
@@ -391,130 +391,130 @@ void fileBrowser::showListMenu(QListViewItem *item) {
QPopupMenu m;// = new QPopupMenu( Local_View );
if(item) {
if( item->text(0).find("/",0,TRUE))
m.insertItem( tr( "Change Directory" ), this, SLOT( doCd() ));
m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() ));
m.insertItem( tr( "Rescan" ), this, SLOT( populateList() ));
m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
m.insertSeparator();
m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
} else {
m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() ));
m.insertItem( tr( "Rescan" ), this, SLOT( populateList() ));
}
m.exec( QCursor::pos() );
}
void fileBrowser::doCd() {
listClicked( ListView->currentItem());
}
void fileBrowser::makDir() {
InputDialog *fileDlg;
- fileDlg = new InputDialog(this,"Make Directory",TRUE, 0);
+ fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString filename = fileDlg->LineEdit1->text();
qDebug("Make dir");
currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
}
populateList();
}
void fileBrowser::localRename() {
QString curFile = ListView->currentItem()->text(0);
InputDialog *fileDlg;
- fileDlg = new InputDialog(this,"Rename",TRUE, 0);
+ fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
fileDlg->setTextEdit((const QString &) curFile);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString oldname = currentDir.canonicalPath() + "/" + curFile;
QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
if( rename(oldname.latin1(), newName.latin1())== -1)
- QMessageBox::message("Note","Could not rename");
+ QMessageBox::message(tr("Note"),tr("Could not rename"));
}
populateList();
}
void fileBrowser::localDelete() {
QString f = ListView->currentItem()->text(0);
if(QDir(f).exists() ) {
- switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+
- " ?\nIt must be empty","Yes","No",0,0,1) ) {
+ switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
+ tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
case 0: {
f=currentDir.canonicalPath()+"/"+f;
QString cmd="rmdir "+f;
system( cmd.latin1());
populateList();
}
break;
case 1:
// exit
break;
};
} else {
- switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f
- +" ?","Yes","No",0,0,1) ) {
+ switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
+ +" ?",tr("Yes"),tr("No"),0,0,1) ) {
case 0: {
f=currentDir.canonicalPath()+"/"+f;
QString cmd="rm "+f;
system( cmd.latin1());
populateList();
}
break;
case 1:
// exit
break;
};
}
}
void fileBrowser::updateMimeTypeMenu() {
disconnect( typemb, SIGNAL(selected(const QString&)),
this, SLOT(showType(const QString&)) );
QString prev;
// Type filter
QStringList types;
types << tr("All");
types << "--";
types += getMimeTypes();
prev = typemb->currentText();
typemb->clear();
typemb->insertItems(types);
// typemb->select(prev);
connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&)));
}
void fileBrowser::showType(const QString &t) {
qDebug(t);
- if(t.find("All",0,TRUE) != -1) {
+ if(t.find(tr("All"),0,TRUE) != -1) {
filterStr = "*";
} else {
QStringList list = mimetypes.grep( t,TRUE);
QString ext;
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
mimeType =(*it);
MimeType mt( mimeType);
// qDebug("mime "+mimeType);
// qDebug("description "+mt.description());
// qDebug( "id "+mt.id());
// qDebug("extension "+mt.extension());
// if( mt.extension().isEmpty())
filterStr = "*";
// else
// filterStr = "*."+ mt.extension()+" ";
// printf( "%s \n", (*it).latin1() );
}
}
currentDir.setNameFilter(filterStr);
populateList();
update();
// if(fileSelector) {
// disconnect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) );
@@ -584,42 +584,42 @@ void fileBrowser::dirPathComboActivated( const QString & current) {
void fileBrowser::dirPathEditPressed() {
QString current = dirPathCombo->lineEdit()->text();
chdir( current.latin1() );
currentDir.cd( current, TRUE);
populateList();
update();
}
void fileBrowser::fillCombo(const QString &currentPath) {
dirPathCombo->lineEdit()->setText(currentPath);
if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
dirPathCombo->clear();
dirPathStringList.prepend(currentPath );
dirPathCombo->insertStringList( dirPathStringList,-1);
}
}
InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl )
{
if ( !name )
- setName( "InputDialog" );
+ setName( tr("InputDialog") );
resize( 234, 50 );
setMaximumSize( QSize( 240, 50 ) );
setCaption( tr(name ) );
LineEdit1 = new QLineEdit( this, "LineEdit1" );
LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) );
}
InputDialog::~InputDialog()
{
inputText= LineEdit1->text();
}
void InputDialog::setTextEdit(const QString &string) {
LineEdit1->setText(string);
}
diff --git a/core/apps/textedit/filePermissions.cpp b/core/apps/textedit/filePermissions.cpp
index 5af3971..def957b 100644
--- a/core/apps/textedit/filePermissions.cpp
+++ b/core/apps/textedit/filePermissions.cpp
@@ -14,50 +14,50 @@
#include "filePermissions.h"
#include <qfile.h>
#include <qfileinfo.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qmessagebox.h>
#include <unistd.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <sys/types.h>
#include <pwd.h>
#include <grp.h>
filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName )
: QDialog( parent, name, modal, fl )
{
if ( !name )
- setName( "filePermissions" );
- qDebug("FilePermissions "+fileName);
+ setName( tr("filePermissions") );
+// qDebug("FilePermissions "+fileName);
resize( 236, 210 );
setMaximumSize( QSize( 236, 210 ) );
setCaption( tr( "Set File Permissions" ) );
TextLabel1 = new QLabel( this, "TextLabel1" );
TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) );
TextLabel1->setText( tr( "Set file permissions for:" ) );
LineEdit1 = new QLineEdit( this, "LineEdit1" );
LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) );
LineEdit1->setReadOnly(true);
TextLabel4 = new QLabel( this, "TextLabel4" );
TextLabel4->setGeometry( QRect( 5, 85, 50, 15 ) );
TextLabel4->setText( tr( "owner" ) );
TextLabel4_2 = new QLabel( this, "TextLabel4_2" );
TextLabel4_2->setGeometry( QRect( 5, 105, 50, 15 ) );
TextLabel4_2->setText( tr( "group" ) );
TextLabel4_3 = new QLabel( this, "TextLabel4_3" );
TextLabel4_3->setGeometry( QRect( 5, 125, 50, 15 ) );
TextLabel4_3->setText( tr( "others" ) );
@@ -227,48 +227,48 @@ void filePermissions::wrldReadCheck() {
void filePermissions::wrldWriteCheck() {
if(CheckBox1_8->isChecked()) { i_mode +=2; }
else i_mode -=2;
modeStr.sprintf("0%d",i_mode);
ModeLine->setText(modeStr);
// 0002
}
void filePermissions::wrldExeCheck() {
if(CheckBox1_8_2->isChecked()) { i_mode +=1; }
else i_mode -=1;
modeStr.sprintf("0%d",i_mode);
ModeLine->setText(modeStr);
// 0001
}
void filePermissions::accept() {
QFileInfo fi(file);
struct passwd *pwd=0;
struct group *grp=0;
pwd = getpwnam(OwnerLineEdit->text().latin1() );
if(pwd == NULL) {
perror("getpwnam");
- QMessageBox::warning(this,"Warning","Error- no user");
+ QMessageBox::warning(this,tr("Warning"),tr("Error- no user"));
return;
} else {
grp = getgrnam(GroupLineEdit->text().latin1());
if(grp==NULL) {
perror("getgrnam");
- QMessageBox::warning(this,"Warning","Error- no group");
+ QMessageBox::warning(this,tr("Warning"),tr("Error- no group"));
return;
}
if( chown( file.latin1(), pwd->pw_uid, grp->gr_gid) <0) {
perror("chown");
- QMessageBox::warning(this,"Warning","Error setting ownership or group");
+ QMessageBox::warning(this,tr("Warning"),tr("Error setting ownership or group"));
return;
}
bool ok;
uint moder = modeStr.toUInt(&ok,8);
if( chmod( file.latin1(), moder) < 0) {
perror("chmod");
- QMessageBox::warning(this,"Warning","Error setting mode");
+ QMessageBox::warning(this,tr("Warning"),tr("Error setting mode"));
return;
}
}
close();
}
diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp
index f2a5355..b1ddc0b 100644
--- a/core/apps/textedit/fileSaver.cpp
+++ b/core/apps/textedit/fileSaver.cpp
@@ -9,98 +9,98 @@
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#include "fileSaver.h"
#include <qpe/config.h>
#include <qpe/resource.h>
#include <qpe/mimetype.h>
#include <qpe/qpeapplication.h>
#include <qlistview.h>
#include <qpushbutton.h>
#include <qfile.h>
#include <qmessagebox.h>
#include <qlineedit.h>
#include <qcheckbox.h>
#include <unistd.h>
fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl , const QString currentFileName )
: QDialog( parent, name, modal, fl )
{
if ( !name )
- setName( "fileSaver" );
+ setName( tr("fileSaver"));
resize( 240, 280 );
setCaption(tr( name ) );
QFileInfo fi(currentFileName);
QString tmpFileName=fi.fileName();
// qDebug( tmpFileName);
dirLabel = new QLabel(this, "DirLabel");
dirLabel->setText(currentDir.canonicalPath());
dirLabel->setGeometry(10,20,230,15);
homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton");
homeButton->setGeometry(200,4,25,25);
connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
homeButton->setFlat(TRUE);
docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
docButton->setGeometry(170,4,25,25);
connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
docButton->setFlat(TRUE);
hideButton = new QPushButton( Resource::loadIconSet("textedit/s_hidden"),"",this,"hideButton");
hideButton->setGeometry(140,4,25,25);
connect( hideButton,SIGNAL(toggled(bool)),this,SLOT( hideButtonPushed(bool)) );
hideButton->setToggleButton(TRUE);
hideButton->setFlat(TRUE);
ListView = new QListView( this, "ListView" );
ListView->addColumn( tr( "Name" ) );
ListView->setColumnWidth(0,120);
ListView->setSorting( 2, FALSE);
ListView->addColumn( tr( "Size" ) );
ListView->setColumnWidth(1,-1);
- ListView->addColumn( "Date",-1);
+ ListView->addColumn( tr("Date"),-1);
ListView->setColumnWidthMode(0,QListView::Manual);
ListView->setColumnAlignment(1,QListView::AlignRight);
// ListView->setMultiSelection(true);
// ListView->setSelectionMode(QListView::Extended);
ListView->setAllColumnsShowFocus( TRUE );
ListView->setGeometry( QRect( 10,35,220,125));
fileEdit= new QLineEdit(this);
fileEdit->setGeometry( QRect( 10, 162, 205, 17));
fileEdit->setText( tmpFileName);
filePermCheck = new QCheckBox( this, "SetFilePerms" );
- filePermCheck->setText("set file permissions");
+ filePermCheck->setText(tr("set file permissions"));
filePermCheck->setGeometry(10, 178, 150,17);
// signals and slots connections
connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) );
connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
// tmpFileName=fi.FilePath();
// qDebug( tmpFileName);
currentDir.setPath( QDir::currentDirPath() );
currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All);
populateList();
move(0,15);
fileEdit->setFocus();
}
fileSaver::~fileSaver()
{
}
void fileSaver::populateList()
{
ListView->clear();
bool isDir=FALSE;
currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
currentDir.setMatchAllDirs(TRUE);
diff --git a/core/apps/textedit/fontDialog.cpp b/core/apps/textedit/fontDialog.cpp
index e7bd924..681e8a6 100644
--- a/core/apps/textedit/fontDialog.cpp
+++ b/core/apps/textedit/fontDialog.cpp
@@ -14,49 +14,49 @@ copyright 2002 by L.J. Potter ljp@llornkcor.com
#include "fontDialog.h"
#include <qpe/fontdatabase.h>
#include <qpe/config.h>
#include <qstringlist.h>
#include <qfontinfo.h>
#include <qvaluelist.h>
#include <qpe/qpeapplication.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlistbox.h>
#include <qmultilineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
FontDialog::FontDialog( QWidget * parent, const char* name , bool modal, WFlags fl )
:QDialog /*QWidget*/( parent, name , modal, fl )
{
if ( !name )
- setName( "FontDialog" );
+ setName( tr("FontDialog") );
setCaption( tr( "Font Dialog" ) );
FontTextLabel4 = new QLabel( this, "TextLabel4" );
FontTextLabel4->setGeometry( QRect( 145, 100, 30, 19 /*192, 0, 43, 19*/ ) );
FontTextLabel4->setText( tr( "Size" ) );
FamilyGroup = new QGroupBox( this, "FamilyGroup" );
FamilyGroup->setGeometry( QRect( 5, 5, 115, 135 /*0, 6, 185, 131 */) );
FamilyGroup->setTitle( tr( "Font" ) );
familyListBox = new QListBox( FamilyGroup, "familyListBox" );
familyListBox->setGeometry( QRect( 5, 20, 100, 105 /* 6, 18, 170, 105 */) );
GroupBox2 = new QGroupBox( this, "GroupBox2" );
GroupBox2->setGeometry( QRect( 120, 5, 100, 90/* 0, 138, 170, 90*/ ) );
GroupBox2->setTitle( tr( "Font Style" ) );
styleListBox = new QListBox( GroupBox2, "styleListBox" );
styleListBox->setGeometry( QRect( 5, 20, 90, 60 /*10, 20, 150, 61*/ ) );
sizeListBox = new QListBox( this, "sizeListBox" );
sizeListBox->setGeometry( QRect( 180, 100, 40, 60 /* 192, 24, 40, 108 */) );
MultiLineEdit1 = new QMultiLineEdit( this, "MultiLineEdit1" );
MultiLineEdit1->setGeometry( QRect( 5, 165, 215, 45 /* 6, 234, 222, 55*/ ) );
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index d28ece8..6804918 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -314,49 +314,49 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
#if 0
QAction *ba = new QAction( tr("Bold"), QString::null, 0, this, 0 );
connect( ba, SIGNAL( toggled(bool) ), this, SLOT( setBold(bool) ) );
ba->setToggleAction(TRUE);
ba->addTo( font );
QAction *ia = new QAction( tr("Italic"), QString::null, 0, this, 0 );
connect( ia, SIGNAL( toggled(bool) ), this, SLOT( setItalic(bool) ) );
ia->setToggleAction(TRUE);
ia->addTo( font );
ba->setOn(defb);
ia->setOn(defi);
font->insertSeparator();
#endif
QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 );
connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) );
wa->setToggleAction(TRUE);
wa->addTo( font );
font->insertSeparator();
- font->insertItem("Font", this, SLOT(changeFont()) );
+ font->insertItem(tr("Font"), this, SLOT(changeFont()) );
font->insertSeparator();
nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 );
connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) );
nStart->setToggleAction(TRUE);
nStart->addTo( font );
mb->insertItem( tr( "File" ), file );
mb->insertItem( tr( "Edit" ), edit );
mb->insertItem( tr( "View" ), font );
searchBar = new QPEToolBar(this);
addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
searchBar->setHorizontalStretchable( TRUE );
searchEdit = new QLineEdit( searchBar, "searchEdit" );
searchBar->setStretchableWidget( searchEdit );
connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
this, SLOT( search() ) );
a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
a->addTo( searchBar );
@@ -472,90 +472,90 @@ void TextEdit::setBold(bool y)
void TextEdit::setItalic(bool y)
{
QFont f = editor->font();
f.setItalic(y);
editor->setFont(f);
}
void TextEdit::setWordWrap(bool y)
{
bool state = editor->edited();
editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap );
editor->setEdited( state );
}
void TextEdit::fileNew()
{
if( !bFromDocView ) {
saveAs();
}
newFile(DocLnk());
}
void TextEdit::fileOpen()
{
- browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "text/*"); //
+ browseForFiles=new fileBrowser(this,tr("Open File"),TRUE,0, "text/*"); //
browseForFiles->setFileView( viewSelection );
browseForFiles->showMaximized();
if( browseForFiles->exec() != -1 ) {
QString selFile = browseForFiles->selectedFileName;
QStringList fileList = browseForFiles->fileList;
qDebug(selFile);
QStringList::ConstIterator f;
QString fileTemp;
for ( f = fileList.begin(); f != fileList.end(); f++ ) {
fileTemp = *f;
fileTemp.right( fileTemp.length()-5);
QString fileName = fileTemp;
if( fileName != "Unnamed" || fileName != "Empty Text" ) {
currentFileName = fileName;
qDebug("please open "+currentFileName);
openFile(fileName );
}
}
viewSelection = browseForFiles->SelectionCombo->currentItem();
}
delete browseForFiles;
editor->setEdited( FALSE);
edited1=FALSE;
edited=FALSE;
if(caption().left(1)=="*")
setCaption(caption().right(caption().length()-1));
doSearchBar();
}
void TextEdit::doSearchBar()
{
Config cfg("TextEdit");
cfg.setGroup("View");
if(cfg.readEntry("SearchBar","Closed") != "Opened")
searchBar->hide();
}
#if 0
void TextEdit::slotFind()
{
- FindDialog frmFind( "Text Editor", this );
+ FindDialog frmFind( tr("Text Editor"), this );
connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)),
editor, SLOT(slotDoFind( const QString&,bool,bool)));
//case sensitive, backwards, [category]
connect( editor, SIGNAL(notFound()),
&frmFind, SLOT(slotNotFound()) );
connect( editor, SIGNAL(searchWrapped()),
&frmFind, SLOT(slotWrapAround()) );
frmFind.exec();
}
#endif
void TextEdit::fileRevert()
{
clear();
fileOpen();
}
void TextEdit::editCut()
{
@@ -726,99 +726,99 @@ bool TextEdit::save()
return false;
}
/*!
prompted save */
bool TextEdit::saveAs()
{
// qDebug("saveAsFile "+currentFileName);
// case of nothing to save... /// there's always something to save
// if ( !doc )//|| !bFromDocView)
// {
// qDebug("no doc");
// return true;
// }
if ( !editor->edited() ) {
delete doc;
doc = 0;
return true;
}
QString rt = editor->text();
qDebug(currentFileName);
- if( currentFileName.isEmpty() || currentFileName == "Unnamed") {
+ if( currentFileName.isEmpty() || currentFileName == tr("Unnamed")) {
qDebug("do silly TT filename thing");
if ( doc->name().isEmpty() ) {
QString pt = rt.simplifyWhiteSpace();
int i = pt.find( ' ' );
QString docname = pt;
if ( i > 0 )
docname = pt.left( i );
// remove "." at the beginning
while( docname.startsWith( "." ) )
docname = docname.mid( 1 );
docname.replace( QRegExp("/"), "_" );
// cut the length. filenames longer than that don't make sense and something goes wrong when they get too long.
if ( docname.length() > 40 )
docname = docname.left(40);
if ( docname.isEmpty() )
- docname = "Unnamed";
+ docname = tr("Unnamed");
doc->setName(docname);
currentFileName=docname;
}
}
- fileSaveDlg=new fileSaver(this,"Save File As?",TRUE, 0, currentFileName);
+ fileSaveDlg=new fileSaver(this,tr("Save File As?"),TRUE, 0, currentFileName);
qDebug("wanna save filename "+currentFileName);
fileSaveDlg->exec();
if( fileSaveDlg->result() == 1 ) {
QString fileNm=fileSaveDlg->selectedFileName;
qDebug("saving filename "+fileNm);
QFileInfo fi(fileNm);
currentFileName=fi.fileName();
if(doc) {
// QString file = doc->file();
// doc->removeFiles();
delete doc;
DocLnk nf;
nf.setType("text/plain");
nf.setFile( fileNm);
doc = new DocLnk(nf);
// editor->setText(rt);
// qDebug("openFile doclnk "+currentFileName);
doc->setName( currentFileName);
updateCaption( currentFileName);
FileManager fm;
if ( !fm.saveFile( *doc, rt ) ) {
return false;
}
if( fileSaveDlg->filePermCheck->isChecked() ) {
filePermissions *filePerm;
- filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm);
+ filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm);
filePerm->exec();
if( filePerm)
delete filePerm;
}
}
}
editor->setEdited(TRUE);
edited1=FALSE;
edited=TRUE;
if(caption().left(1)=="*")
setCaption(caption().right(caption().length()-1));
if(fileSaveDlg)
delete fileSaveDlg;
return true;
}
void TextEdit::clear()
{
delete doc;
doc = 0;
editor->clear();
}
@@ -867,61 +867,61 @@ void TextEdit::accept()
QString file = doc->file();
if (file.find("_.txt",0,TRUE) ==-1)
save();
else {
QFile(file).remove();
}
exit(0);
}
void TextEdit::changeFont() {
FontDatabase fdb;
QFont defaultFont=editor->font();
QFontInfo fontInfo(defaultFont);
Config cfg("TextEdit");
cfg.setGroup("Font");
QString family = cfg.readEntry("Family", fontInfo.family());
QString style = cfg.readEntry("Style", fdb.styleString(defaultFont));
int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10);
QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) );
defaultFont = fdb.font(family,style,i_size,charSet);
FontDialog *fontDlg;
- fontDlg=new FontDialog(this,"FontDialog",TRUE);
+ fontDlg=new FontDialog(this,tr("FontDialog"),TRUE);
fontDlg->exec();
QFont myFont=fontDlg->selectedFont;
editor->setFont( myFont);
delete fontDlg;
}
void TextEdit::editDelete()
{
- switch ( QMessageBox::warning(this,"Text Editor","Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!","Yes","No",0,0,1) ) {
+ switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!"),tr("Yes"),tr("No"),0,0,1) ) {
case 0:
if(doc) {
doc->removeFiles();
clear();
setCaption( tr("Text Editor") );
}
break;
case 1:
// exit
break;
};
}
void TextEdit::changeStartConfig( bool b ) {
Config cfg("TextEdit");
cfg.setGroup("View");
if(b) {
qDebug("bool");
cfg.writeEntry("startNew","TRUE");
} else {
cfg.writeEntry("startNew","FALSE");
}
update();