Commit 9befb3ed authored by Bernd Gehrmann's avatar Bernd Gehrmann

* Mark files with option -kb with a binary icon

* Fixed restoration of the last loaded sandbox

svn path=/trunk/kdesdk/cervisia/; revision=163447
parent aa590be7
2002-06-27 Bernd Gehrmann <bernd@mail.berlios.de>
* Mark files with option -kb with a binary icon
* Fixed restoration of the last loaded sandbox
2002-06-26 Bernd Gehrmann <bernd@mail.berlios.de>
* Made editor configurable again
......
......@@ -92,7 +92,7 @@ KAboutData *CervisiaFactory::aboutData()
CERVISIA_VERSION,
I18N_NOOP("A CVS frontend"),
KAboutData::License_QPL,
I18N_NOOP("(c) 1999-2002 Bernd Gehrmann"));
I18N_NOOP("Copyright (c) 1999-2002 Bernd Gehrmann"));
}
CervisiaPart::CervisiaPart( QWidget *parentWidget, const char *widgetName,
......
......@@ -42,7 +42,7 @@ CervisiaShell::CervisiaShell( const char *name )
CervisiaShell::~CervisiaShell()
{
delete part;
}
void CervisiaShell::setupActions()
......@@ -140,30 +140,16 @@ bool CervisiaShell::queryExit()
config->writeEntry("Customized", true);
config->writeEntry("Size", size());
part->saveDialogProperties( config );
config->setGroup( "Session" );
part->saveProperties( config );
part->saveDialogProperties(config);
config->setGroup("Session");
saveProperties(config);
config->sync();
return true;
}
void CervisiaShell::readProperties(KConfig *config)
{
part->readProperties( config );
QString currentDir = config->readEntry("Current Directory");
if (!currentDir.isEmpty())
part->openSandbox(currentDir);
}
void CervisiaShell::saveProperties(KConfig *config)
{
part->saveProperties( config );
config->writeEntry( "Current Directory", part->sandBox() );
}
void CervisiaShell::restorePseudo( const QString &dirname )
void CervisiaShell::restorePseudo(const QString &dirname)
{
KConfig *config = part->config();
......@@ -171,14 +157,31 @@ void CervisiaShell::restorePseudo( const QString &dirname )
if (config->readBoolEntry("Customized"))
resize(config->readSizeEntry("Size"));
part->readDialogProperties( config );
part->readDialogProperties(config);
config->setGroup("Session");
// Explicitly override the loaded directory if
// a command line argument is given
if (!dirname.isEmpty())
config->writeEntry("Current Directory", dirname);
readProperties(config);
}
void CervisiaShell::readProperties(KConfig *config)
{
part->readProperties( config );
QString currentDir = config->readEntry("Current Directory");
if (!currentDir.isEmpty())
part->openSandbox(currentDir);
}
void CervisiaShell::saveProperties(KConfig *config)
{
part->saveProperties(config);
config->writeEntry("Current Directory", part->sandBox());
}
#include "cervisiashell.moc"
......
......@@ -46,7 +46,7 @@ public:
void syncWithEntries();
void updateChildItem(QString name, UpdateView::Status status, bool isdir);
void updateEntriesItem(QString name, UpdateView::Status status, bool isdir,
QString rev, QString tagname, time_t timestamp);
bool isbin, QString rev, QString tagname, time_t timestamp);
virtual QString key(int col, bool) const;
virtual QString text(int col) const;
virtual void setOpen(bool o);
......@@ -131,7 +131,6 @@ QString UpdateDirItem::dirPath()
*/
void UpdateDirItem::updateChildItem(QString name, UpdateView::Status status, bool isdir)
{
kdDebug() << "Updating " << name << " in " << dirPath() << endl;
for (ListViewItem *item = myFirstChild(); item;
item = item->myNextSibling() )
{
......@@ -166,7 +165,7 @@ void UpdateDirItem::updateChildItem(QString name, UpdateView::Status status, boo
* new items and for items which were NotInCVS.
*/
void UpdateDirItem::updateEntriesItem(QString name, UpdateView::Status status, bool isdir,
QString rev, QString tagname, time_t timestamp)
bool isbin, QString rev, QString tagname, time_t timestamp)
{
for (ListViewItem *item = myFirstChild(); item;
item = item->myNextSibling() )
......@@ -189,12 +188,13 @@ void UpdateDirItem::updateEntriesItem(QString name, UpdateView::Status status, b
}
viewitem->setRevTag(rev, tagname);
viewitem->setTimestamp(timestamp);
if (isbin)
viewitem->setPixmap(0, SmallIcon("binary"));
}
return;
}
}
kdDebug() << "new entries item for " << name << endl;
// Not found, make new entry
if (isdir)
( new UpdateDirItem(this, name) )->maybeScanDir(true);
......@@ -229,10 +229,10 @@ void UpdateDirItem::scanDirectory()
}
static const char *lastModifiedStr(const char *fname)
static QString lastModifiedStr(const QString &fname)
{
struct stat st;
if (lstat(fname, &st) != 0)
if (lstat(fname.local8Bit(), &st) != 0)
return "";
struct tm *tm_p = gmtime(&st.st_mtime);
char *p = asctime(tm_p);
......@@ -250,7 +250,7 @@ void UpdateDirItem::syncWithEntries()
QString name, rev, timestamp, options, tagdate;
UpdateView::Status status;
FILE *f = fopen(QString(dirPath() + QString("CVS/Entries")).latin1(), "r");
FILE *f = fopen(QString(dirPath() + QString("CVS/Entries")).local8Bit(), "r");
if (!f)
return;
......@@ -279,6 +279,7 @@ void UpdateDirItem::syncWithEntries()
continue;
*nextp = '\0';
options = QString(p); p = nextp+1;
bool isbin = (options == "-kb");
if ( (nextp = strchr(p, '\n')) == 0)
continue;
*nextp = '\0';
......@@ -296,7 +297,7 @@ void UpdateDirItem::syncWithEntries()
status = UpdateView::Conflict;
timestamp.truncate(timestamp.find('+'));
}
else if (timestamp != lastModifiedStr(QString(dirPath() + name).latin1()))
else if (timestamp != lastModifiedStr(dirPath() + name))
status = UpdateView::LocallyModified;
else
status = UpdateView::Unknown;
......@@ -310,7 +311,7 @@ void UpdateDirItem::syncWithEntries()
strptime(timestamp.local8Bit(), "%c" , &tmp);
setlocale(LC_TIME, oldLocale);
time = mktime(&tmp);
updateEntriesItem(name, status, isdir, rev, tagdate, time);
updateEntriesItem(name, status, isdir, isbin, rev, tagdate, time);
}
fclose(f);
}
......@@ -686,7 +687,7 @@ UpdateView::~UpdateView()
bool UpdateView::isDirItem(QListViewItem *item)
{
return qstrcmp(item->text(1).latin1(), "") == 0;
return item->text(1).isEmpty();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment