You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.0 KiB
91 lines
2.0 KiB
15 years ago
|
|
||
12 years ago
|
#include <tdeparts/event.h>
|
||
15 years ago
|
|
||
|
#include "parts.h"
|
||
|
|
||
14 years ago
|
#include <tqcheckbox.h>
|
||
|
#include <tqfile.h>
|
||
|
#include <tqdir.h>
|
||
13 years ago
|
#include <tqtextstream.h>
|
||
14 years ago
|
#include <tqmultilineedit.h>
|
||
|
#include <tqlineedit.h>
|
||
|
#include <tqvbox.h>
|
||
15 years ago
|
|
||
|
#include <kiconloader.h>
|
||
|
#include <kapplication.h>
|
||
|
#include <kdebug.h>
|
||
|
#include <kmessagebox.h>
|
||
|
#include <kaction.h>
|
||
|
#include <klocale.h>
|
||
|
|
||
14 years ago
|
Part1::Part1( TQObject *parent, TQWidget * parentWidget )
|
||
15 years ago
|
: KParts::ReadOnlyPart( parent, "Part1" )
|
||
|
{
|
||
12 years ago
|
m_instance = new TDEInstance( "tdepartstestpart" );
|
||
15 years ago
|
setInstance( m_instance );
|
||
14 years ago
|
m_edit = new TQMultiLineEdit( parentWidget );
|
||
15 years ago
|
setWidget( m_edit );
|
||
12 years ago
|
setXMLFile( "tdepartstest_part1.rc" );
|
||
15 years ago
|
|
||
|
/*KAction * paBlah = */ new KAction( "Blah", "filemail", 0, actionCollection(), "p1_blah" );
|
||
|
}
|
||
|
|
||
|
Part1::~Part1()
|
||
|
{
|
||
|
delete m_instance;
|
||
|
}
|
||
|
|
||
|
bool Part1::openFile()
|
||
|
{
|
||
14 years ago
|
kdDebug() << "Part1: opening " << TQFile::encodeName(m_file) << endl;
|
||
15 years ago
|
// Hehe this is from a tutorial I did some time ago :)
|
||
14 years ago
|
TQFile f(m_file);
|
||
|
TQString s;
|
||
15 years ago
|
if ( f.open(IO_ReadOnly) ) {
|
||
14 years ago
|
TQTextStream t( &f );
|
||
15 years ago
|
while ( !t.eof() ) {
|
||
|
s += t.readLine() + "\n";
|
||
|
}
|
||
|
f.close();
|
||
|
} else
|
||
|
return false;
|
||
|
m_edit->setText(s);
|
||
|
|
||
|
emit setStatusBarText( m_url.prettyURL() );
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
14 years ago
|
Part2::Part2( TQObject *parent, TQWidget * parentWidget )
|
||
15 years ago
|
: KParts::Part( parent, "Part2" )
|
||
|
{
|
||
12 years ago
|
m_instance = new TDEInstance( "part2" );
|
||
15 years ago
|
setInstance( m_instance );
|
||
14 years ago
|
TQWidget * w = new TQWidget( parentWidget, "Part2Widget" );
|
||
15 years ago
|
setWidget( w );
|
||
|
|
||
14 years ago
|
TQCheckBox * cb = new TQCheckBox( "something", w );
|
||
15 years ago
|
|
||
14 years ago
|
TQLineEdit * l = new TQLineEdit( "something", widget() );
|
||
15 years ago
|
l->move(0,50);
|
||
|
// Since the main widget is a dummy one, we HAVE to set
|
||
|
// strong focus for it, otherwise we get the
|
||
|
// the famous activating-file-menu-switches-part bug.
|
||
14 years ago
|
w->setFocusPolicy( TQWidget::ClickFocus );
|
||
15 years ago
|
|
||
|
// setXMLFile( ... ); // no actions currently
|
||
|
}
|
||
|
|
||
|
Part2::~Part2()
|
||
|
{
|
||
|
delete m_instance;
|
||
|
}
|
||
|
|
||
|
void Part2::guiActivateEvent( KParts::GUIActivateEvent * event )
|
||
|
{
|
||
|
if (event->activated())
|
||
|
emit setWindowCaption("[part2 activated]");
|
||
|
}
|
||
|
|
||
|
#include "parts.moc"
|